public function renderForm()
 {
     if (!$this->object->id) {
         $this->object->price = -1;
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Catalog price rules'), 'icon' => 'icon-dollar'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'maxlength' => 32, 'required' => true, 'hint' => $this->l('Forbidden characters') . ' <>;=#{}'), array('type' => 'select', 'label' => $this->l('Shop'), 'name' => 'shop_id', 'options' => array('query' => Shop::getShops(), 'id' => 'id_shop', 'name' => 'name'), 'condition' => Shop::isFeatureActive(), 'default_value' => Shop::getContextShopID()), array('type' => 'select', 'label' => $this->l('Currency'), 'name' => 'id_currency', 'options' => array('query' => array_merge(array(0 => array('id_currency' => 0, 'name' => $this->l('All currencies'))), Currency::getCurrencies()), 'id' => 'id_currency', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'options' => array('query' => array_merge(array(0 => array('id_country' => 0, 'name' => $this->l('All countries'))), Country::getCountries((int) $this->context->language->id)), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Group'), 'name' => 'id_group', 'options' => array('query' => array_merge(array(0 => array('id_group' => 0, 'name' => $this->l('All groups'))), Group::getGroups((int) $this->context->language->id)), 'id' => 'id_group', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('From quantity'), 'name' => 'from_quantity', 'maxlength' => 10, 'required' => true), array('type' => 'text', 'label' => $this->l('Price (tax excl.)'), 'name' => 'price', 'disabled' => $this->object->price == -1 ? 1 : 0, 'maxlength' => 10, 'suffix' => $this->context->currency->getSign('right')), array('type' => 'checkbox', 'name' => 'leave_bprice', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Leave base price'), 'val' => '1', 'checked' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'datetime', 'label' => $this->l('From'), 'name' => 'from'), array('type' => 'datetime', 'label' => $this->l('To'), 'name' => 'to'), array('type' => 'select', 'label' => $this->l('Reduction type'), 'name' => 'reduction_type', 'options' => array('query' => array(array('reduction_type' => 'amount', 'name' => $this->l('Amount')), array('reduction_type' => 'percentage', 'name' => $this->l('Percentage'))), 'id' => 'reduction_type', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Reduction with or without taxes'), 'name' => 'reduction_tax', 'align' => 'center', 'options' => array('query' => array(array('lab' => $this->l('Tax included'), 'val' => 1), array('lab' => $this->l('Tax excluded'), 'val' => 0)), 'id' => 'val', 'name' => 'lab')), array('type' => 'text', 'label' => $this->l('Reduction'), 'name' => 'reduction', 'required' => true)), 'submit' => array('title' => $this->l('Save')));
     if (($value = $this->getFieldValue($this->object, 'price')) != -1) {
         $price = number_format($value, 6);
     } else {
         $price = '';
     }
     $this->fields_value = array('price' => $price, 'from_quantity' => ($value = $this->getFieldValue($this->object, 'from_quantity')) ? $value : 1, 'reduction' => number_format(($value = $this->getFieldValue($this->object, 'reduction')) ? $value : 0, 6), 'leave_bprice_on' => $price ? 0 : 1);
     $attribute_groups = array();
     $attributes = Attribute::getAttributes((int) $this->context->language->id);
     foreach ($attributes as $attribute) {
         if (!isset($attribute_groups[$attribute['id_attribute_group']])) {
             $attribute_groups[$attribute['id_attribute_group']] = array('id_attribute_group' => $attribute['id_attribute_group'], 'name' => $attribute['attribute_group']);
         }
         $attribute_groups[$attribute['id_attribute_group']]['attributes'][] = array('id_attribute' => $attribute['id_attribute'], 'name' => $attribute['name']);
     }
     $features = Feature::getFeatures((int) $this->context->language->id);
     foreach ($features as &$feature) {
         $feature['values'] = FeatureValue::getFeatureValuesWithLang((int) $this->context->language->id, $feature['id_feature'], true);
     }
     $this->tpl_form_vars = array('manufacturers' => Manufacturer::getManufacturers(), 'suppliers' => Supplier::getSuppliers(), 'attributes_group' => $attribute_groups, 'features' => $features, 'categories' => Category::getSimpleCategories((int) $this->context->language->id), 'conditions' => $this->object->getConditions(), 'is_multishop' => Shop::isFeatureActive());
     return parent::renderForm();
 }
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('SQL query'), 'icon' => 'icon-cog'), 'input' => array(array('type' => 'text', 'label' => $this->l('SQL query name'), 'name' => 'name', 'size' => 103, 'required' => true), array('type' => 'textarea', 'label' => $this->l('SQL query'), 'name' => 'sql', 'cols' => 100, 'rows' => 10, 'required' => true)), 'submit' => array('title' => $this->l('Save')));
     $request = new RequestSql();
     $this->tpl_form_vars = array('tables' => $request->getTables());
     return parent::renderForm();
 }
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Print a PDF'), 'image' => '../img/admin/pdf.gif'), 'input' => array(array('type' => 'date', 'label' => $this->l('From:'), 'name' => 'date_from', 'size' => 20, 'maxlength' => 10, 'required' => true, 'desc' => $this->l('Format: 2011-12-31 (inclusive)')), array('type' => 'date', 'label' => $this->l('To:'), 'name' => 'date_to', 'size' => 20, 'maxlength' => 10, 'required' => true, 'desc' => $this->l('Format: 2012-12-31 (inclusive)'))), 'submit' => array('title' => $this->l('Generate PDF file'), 'class' => 'button', 'id' => 'submitPrint'));
     $this->fields_value = array('date_from' => date('Y-m-d'), 'date_to' => date('Y-m-d'));
     $this->show_toolbar = false;
     return parent::renderForm();
 }
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Print a PDF'), 'icon' => 'icon-print'), 'input' => array(array('type' => 'date', 'label' => $this->l('From'), 'name' => 'date_from', 'maxlength' => 10, 'required' => true, 'hint' => $this->l('Format: 2011-12-31 (inclusive).')), array('type' => 'date', 'label' => $this->l('To'), 'name' => 'date_to', 'maxlength' => 10, 'required' => true, 'hint' => $this->l('Format: 2012-12-31 (inclusive).'))), 'submit' => array('title' => $this->l('Generate PDF file'), 'id' => 'submitPrint', 'icon' => 'process-icon-download-alt'));
     $this->fields_value = array('date_from' => date('Y-m-d'), 'date_to' => date('Y-m-d'));
     $this->show_toolbar = false;
     return parent::renderForm();
 }
    public function renderForm()
    {
        if (!($obj = $this->loadObject(true))) {
            return;
        }
        $address_layout = AddressFormat::getAddressCountryFormat($obj->id);
        if ($value = Tools::getValue('address_layout')) {
            $address_layout = $value;
        }
        $default_layout = '';
        $default_layout_tab = array(array('firstname', 'lastname'), array('company'), array('vat_number'), array('address1'), array('address2'), array('postcode', 'city'), array('Country:name'), array('phone'), array('phone_mobile'));
        foreach ($default_layout_tab as $line) {
            $default_layout .= implode(' ', $line) . "\r\n";
        }
        $this->fields_form = array('legend' => array('title' => $this->l('Countries'), 'image' => '../img/admin/world.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Country:'), 'name' => 'name', 'lang' => true, 'size' => 30, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'desc' => $this->l('Country name')), array('type' => 'text', 'label' => $this->l('ISO code:'), 'name' => 'iso_code', 'size' => 4, 'maxlength' => 3, 'class' => 'uppercase', 'required' => true, 'desc' => $this->l('Two -- or three -- letter ISO code (e.g. U.S. for United States)') . '.
							<a href="http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm" target="_blank">' . $this->l('Official list here') . '
							</a>.'), array('type' => 'text', 'label' => $this->l('Call prefix:'), 'name' => 'call_prefix', 'size' => 4, 'maxlength' => 3, 'class' => 'uppercase', 'required' => true, 'desc' => $this->l('International call prefix, (e.g. 1 for United States)')), array('type' => 'select', 'label' => $this->l('Default currency:'), 'name' => 'id_currency', 'options' => array('query' => Currency::getCurrencies(), 'id' => 'id_currency', 'name' => 'name', 'default' => array('label' => $this->l('Default store currency'), 'value' => 0))), array('type' => 'select', 'label' => $this->l('Zone:'), 'name' => 'id_zone', 'options' => array('query' => Zone::getZones(), 'id' => 'id_zone', 'name' => 'name'), 'desc' => $this->l('Geographical region')), array('type' => 'radio', 'label' => $this->l('Need zip/postal code:'), 'name' => 'need_zip_code', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'need_zip_code_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'need_zip_code_off', 'value' => 0, 'label' => $this->l('No')))), array('type' => 'text', 'label' => $this->l('Zip/post code format:'), 'name' => 'zip_code_format', 'class' => 'uppercase', 'required' => true, 'desc' => $this->l('Zip Code format (L for a letter, N for a number and C for the ISO code). For example, NNNNN for the United States. No verification if undefined.')), array('type' => 'address_layout', 'label' => $this->l('Address format:'), 'name' => 'address_layout', 'address_layout' => $address_layout, 'encoding_address_layout' => urlencode($address_layout), 'encoding_default_layout' => urlencode($default_layout), 'display_valid_fields' => $this->displayValidFields()), array('type' => 'radio', 'label' => $this->l('Address Standardization:'), 'name' => 'standardization', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'standardization_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'standardization_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Active:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('Display this country to your customers (the selected country will always be displayed in the Back Office)')), array('type' => 'radio', 'label' => $this->l('Contains following  states:'), 'name' => 'contains_states', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'contains_states_on', 'value' => 1, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />' . $this->l('Yes')), array('id' => 'contains_states_off', 'value' => 0, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />' . $this->l('No')))), array('type' => 'radio', 'label' => $this->l('Do you need a tax identification number?'), 'name' => 'need_identification_number', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'need_identification_number_on', 'value' => 1, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />' . $this->l('Yes')), array('id' => 'need_identification_number_off', 'value' => 0, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />' . $this->l('No')))), array('type' => 'radio', 'label' => $this->l('Display tax label (e.g. "Tax incl."):'), 'name' => 'display_tax_label', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'display_tax_label_on', 'value' => 1, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />' . $this->l('Yes')), array('id' => 'display_tax_label_off', 'value' => 0, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />' . $this->l('No'))))));
        if (Shop::isFeatureActive()) {
            $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
        }
        $this->fields_form['submit'] = array('title' => $this->l('Save   '), 'class' => 'button');
        if ($this->object->iso_code == 'US') {
            $this->object->standardization = Configuration::get('PS_TAASC');
        }
        return parent::renderForm();
    }
    public function initFormByStatus()
    {
        $this->fields_form = array('legend' => array('title' => $this->l('By order status'), 'image' => '../img/admin/pdf.gif'), 'input' => array(array('type' => 'checkboxStatuses', 'label' => $this->l('Statuses:'), 'name' => 'id_order_state', 'values' => array('query' => OrderState::getOrderStates($this->context->language->id), 'id' => 'id_order_state', 'name' => 'name'), 'desc' => $this->l('You can also export orders which have not been charged yet.') . ' (<img src="../img/admin/charged_ko.gif" alt="" />).')), 'submit' => array('title' => $this->l('Generate PDF file by status.'), 'class' => 'button', 'id' => 'submitPrint2'));
        $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
			SELECT COUNT(o.id_order) as nbOrders, (
				SELECT oh.id_order_state
				FROM ' . _DB_PREFIX_ . 'order_history oh
				WHERE oh.id_order = oi.id_order
				ORDER BY oh.date_add DESC, oh.id_order_history DESC
				LIMIT 1
			) id_order_state
			FROM ' . _DB_PREFIX_ . 'order_invoice oi
			LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON (oi.id_order = o.id_order)
			WHERE o.id_shop IN(' . implode(', ', Shop::getContextListShopID()) . ')
			GROUP BY id_order_state
		');
        $status_stats = array();
        foreach ($result as $row) {
            $status_stats[$row['id_order_state']] = $row['nbOrders'];
        }
        $this->tpl_form_vars = array('statusStats' => $status_stats, 'style' => '');
        $this->table = 'invoice_status';
        $this->show_toolbar = false;
        return parent::renderForm();
    }
 public function renderForm()
 {
     // loads current warehouse
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Suppliers'), 'image' => '../img/admin/suppliers.gif'), 'input' => array(array('type' => 'hidden', 'name' => 'id_address'), array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'size' => 40, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'textarea', 'label' => $this->l('Description:'), 'name' => 'description', 'cols' => 60, 'rows' => 10, 'lang' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'desc' => $this->l('Will appear in the supplier list')), array('type' => 'text', 'label' => $this->l('Phone:'), 'name' => 'phone', 'size' => 15, 'maxlength' => 16, 'desc' => $this->l('Phone number for this supplier')), array('type' => 'text', 'label' => $this->l('Address:'), 'name' => 'address', 'size' => 100, 'maxlength' => 128, 'required' => true), array('type' => 'text', 'label' => $this->l('Address:') . ' (2)', 'name' => 'address2', 'size' => 100, 'maxlength' => 128), array('type' => 'text', 'label' => $this->l('Postal Code/Zip Code:'), 'name' => 'postcode', 'size' => 10, 'maxlength' => 12, 'required' => true), array('type' => 'text', 'label' => $this->l('City:'), 'name' => 'city', 'size' => 20, 'maxlength' => 32, 'required' => true), array('type' => 'select', 'label' => $this->l('Country:'), 'name' => 'id_country', 'required' => true, 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id, false), 'id' => 'id_country', 'name' => 'name'), 'desc' => $this->l('Country where the state, region or city is located')), array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'options' => array('id' => 'id_state', 'query' => array(), 'name' => 'name')), array('type' => 'file', 'label' => $this->l('Logo:'), 'name' => 'logo', 'display_image' => true, 'desc' => $this->l('Upload a supplier logo from your computer')), array('type' => 'text', 'label' => $this->l('Meta title:'), 'name' => 'meta_title', 'lang' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Meta description:'), 'name' => 'meta_description', 'lang' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'tags', 'label' => $this->l('Meta keywords:'), 'name' => 'meta_keywords', 'lang' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}', 'desc' => $this->l('To add "tags" click in the field, write something and then press "Enter"')), array('type' => 'radio', 'label' => $this->l('Enable:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l('   Save   '), 'class' => 'button'));
     // loads current address for this supplier - if possible
     $address = null;
     if (isset($obj->id)) {
         $id_address = Address::getAddressIdBySupplierId($obj->id);
         if ($id_address > 0) {
             $address = new Address((int) $id_address);
         }
     }
     // force specific fields values (address)
     if ($address != null) {
         $this->fields_value = array('id_address' => $address->id, 'phone' => $address->phone, 'address' => $address->address1, 'address2' => $address->address2, 'postcode' => $address->postcode, 'city' => $address->city, 'id_country' => $address->id_country, 'id_state' => $address->id_state);
     } else {
         $this->fields_value = array('id_address' => 0, 'id_country' => Configuration::get('PS_COUNTRY_DEFAULT'));
     }
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
     }
     // set logo image
     $image = ImageManager::thumbnail(_PS_SUPP_IMG_DIR_ . '/' . $this->object->id . '.jpg', $this->table . '_' . (int) $this->object->id . '.' . $this->imageType, 350, $this->imageType, true);
     $this->fields_value['image'] = $image ? $image : false;
     $this->fields_value['size'] = $image ? filesize(_PS_SUPP_IMG_DIR_ . '/' . $this->object->id . '.jpg') / 1000 : false;
     return parent::renderForm();
 }
 public function renderForm()
 {
     $update_htaccess = Tools::modRewriteActive() && (file_exists('.htaccess') && is_writable('.htaccess') || is_writable(dirname('.htaccess')));
     $this->multiple_fieldsets = true;
     if (!$update_htaccess) {
         $desc_virtual_uri = array('<span class="warning_mod_rewrite">' . $this->l('You need to activate URL Rewriting if you want to add a virtual URL.') . '</span>');
     } else {
         $desc_virtual_uri = array($this->l('You can use this option if you want to create a store with a URL that doesn\'t exist on your server (e.g. if you want your store to be available with the URL www.my-prestashop.com/my-store/shoes/, you have to set shoes/ in this field, assuming that my-store/ is your Physical URL).'), '<strong>' . $this->l('URL rewriting must be activated on your server to use this feature.') . '</strong>');
     }
     $this->fields_form = array(array('form' => array('legend' => array('title' => $this->l('URL options'), 'icon' => 'icon-cogs'), 'input' => array(array('type' => 'select', 'label' => $this->l('Shop'), 'name' => 'id_shop', 'onchange' => 'checkMainUrlInfo(this.value);', 'options' => array('optiongroup' => array('query' => Shop::getTree(), 'label' => 'name'), 'options' => array('query' => 'shops', 'id' => 'id_shop', 'name' => 'name'))), array('type' => 'switch', 'label' => $this->l('Main URL'), 'name' => 'main', 'class' => 't', 'values' => array(array('id' => 'main_on', 'value' => 1), array('id' => 'main_off', 'value' => 0)), 'desc' => array($this->l('If you set this URL as the Main URL for the selected shop, all URLs set to this shop will be redirected to this URL (you can only have one Main URL per shop).'), array('text' => $this->l('Since the selected shop has no main URL, you have to set this URL as the Main URL.'), 'id' => 'mainUrlInfo'), array('text' => $this->l('The selected shop already has a Main URL. Therefore, if you set this one as the Main URL, the older of the two will be set as the normal URL.'), 'id' => 'mainUrlInfoExplain'))), array('type' => 'switch', 'label' => $this->l('Enabled'), 'name' => 'active', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'active_on', 'value' => 1), array('id' => 'active_off', 'value' => 0)))), 'submit' => array('title' => $this->l('Save')))), array('form' => array('legend' => array('title' => $this->l('Shop URL'), 'icon' => 'icon-shopping-cart'), 'input' => array(array('type' => 'text', 'label' => $this->l('Domain'), 'name' => 'domain', 'size' => 50), array('type' => 'text', 'label' => $this->l('Domain SSL'), 'name' => 'domain_ssl', 'size' => 50)), 'submit' => array('title' => $this->l('Save')))));
     if (!defined('_PS_HOST_MODE_')) {
         $this->fields_form[1]['form']['input'] = array_merge($this->fields_form[1]['form']['input'], array(array('type' => 'text', 'label' => $this->l('Physical URL'), 'name' => 'physical_uri', 'desc' => $this->l('This is the physical folder for your store on the server. Leave this field empty if your store is installed on the root path (e.g. if your store is available at www.my-prestashop.com/my-store/, you input my-store/ in this field).'), 'size' => 50)));
     }
     $this->fields_form[1]['form']['input'] = array_merge($this->fields_form[1]['form']['input'], array(array('type' => 'text', 'label' => $this->l('Virtual URL'), 'name' => 'virtual_uri', 'desc' => $desc_virtual_uri, 'size' => 50, 'hint' => !$update_htaccess ? $this->l('Warning: URL rewriting (e.g. mod_rewrite for Apache) seems to be disabled. If your URL doesn\'t work, please check with your host provider on how to activate URL rewriting.') : null), array('type' => 'text', 'label' => $this->l('Your final URL will be'), 'name' => 'final_url', 'size' => 76, 'readonly' => true)));
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     self::$currentIndex = self::$currentIndex . '&id_shop=' . $obj->id;
     $current_shop = Shop::initialize();
     $list_shop_with_url = array();
     foreach (Shop::getShops(false, null, true) as $id) {
         $list_shop_with_url[$id] = (bool) count(ShopUrl::getShopUrls($id));
     }
     $this->tpl_form_vars = array('js_shop_url' => Tools::jsonEncode($list_shop_with_url));
     $this->fields_value = array('domain' => Validate::isLoadedObject($obj) ? $this->getFieldValue($obj, 'domain') : $current_shop->domain, 'domain_ssl' => Validate::isLoadedObject($obj) ? $this->getFieldValue($obj, 'domain_ssl') : $current_shop->domain_ssl, 'physical_uri' => Validate::isLoadedObject($obj) ? $this->getFieldValue($obj, 'physical_uri') : $current_shop->physical_uri, 'active' => true);
     return parent::renderForm();
 }
 public function renderForm()
 {
     // loads current warehouse
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $image = _PS_SUPP_IMG_DIR_ . $obj->id . '.jpg';
     $image_url = ImageManager::thumbnail($image, $this->table . '_' . (int) $obj->id . '.' . $this->imageType, 350, $this->imageType, true, true);
     $image_size = file_exists($image) ? filesize($image) / 1000 : false;
     $tmp_addr = new Address();
     $res = $tmp_addr->getFieldsRequiredDatabase();
     $required_fields = array();
     foreach ($res as $row) {
         $required_fields[(int) $row['id_required_field']] = $row['field_name'];
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Suppliers'), 'icon' => 'icon-truck'), 'input' => array(array('type' => 'hidden', 'name' => 'id_address'), array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'required' => true, 'col' => 4, 'hint' => $this->l('Invalid characters:') . ' &lt;&gt;;=#{}'), in_array('company', $required_fields) ? array('type' => 'text', 'label' => $this->l('Company'), 'name' => 'company', 'display' => in_array('company', $required_fields), 'required' => in_array('company', $required_fields), 'maxlength' => 16, 'col' => 4, 'hint' => $this->l('Company name for this supplier')) : null, array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'description', 'lang' => true, 'hint' => array($this->l('Invalid characters:') . ' &lt;&gt;;=#{}', $this->l('Will appear in the list of suppliers.')), 'autoload_rte' => 'rte'), array('type' => 'text', 'label' => $this->l('Phone'), 'name' => 'phone', 'required' => in_array('phone', $required_fields), 'maxlength' => 16, 'col' => 4, 'hint' => $this->l('Phone number for this supplier')), array('type' => 'text', 'label' => $this->l('Mobile phone'), 'name' => 'phone_mobile', 'required' => in_array('phone_mobile', $required_fields), 'maxlength' => 16, 'col' => 4, 'hint' => $this->l('Mobile phone number for this supplier.')), array('type' => 'text', 'label' => $this->l('Address'), 'name' => 'address', 'maxlength' => 128, 'col' => 6, 'required' => true), array('type' => 'text', 'label' => $this->l('Address') . ' (2)', 'name' => 'address2', 'required' => in_array('address2', $required_fields), 'col' => 6, 'maxlength' => 128), array('type' => 'text', 'label' => $this->l('Zip/postal code'), 'name' => 'postcode', 'required' => in_array('postcode', $required_fields), 'maxlength' => 12, 'col' => 2), array('type' => 'text', 'label' => $this->l('City'), 'name' => 'city', 'maxlength' => 32, 'col' => 4, 'required' => true), array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'required' => true, 'col' => 4, 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id, false), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'col' => 4, 'options' => array('id' => 'id_state', 'query' => array(), 'name' => 'name')), array('type' => 'file', 'label' => $this->l('Logo'), 'name' => 'logo', 'display_image' => true, 'image' => $image_url ? $image_url : false, 'size' => $image_size, 'hint' => $this->l('Upload a supplier logo from your computer.')), array('type' => 'text', 'label' => $this->l('Meta title'), 'name' => 'meta_title', 'lang' => true, 'col' => 4, 'hint' => $this->l('Forbidden characters:') . ' &lt;&gt;;=#{}'), array('type' => 'text', 'label' => $this->l('Meta description'), 'name' => 'meta_description', 'lang' => true, 'col' => 6, 'hint' => $this->l('Forbidden characters:') . ' &lt;&gt;;=#{}'), array('type' => 'tags', 'label' => $this->l('Meta keywords'), 'name' => 'meta_keywords', 'lang' => true, 'col' => 6, 'hint' => array($this->l('To add "tags" click in the field, write something and then press "Enter".'), $this->l('Forbidden characters:') . ' &lt;&gt;;=#{}')), array('type' => 'switch', 'label' => $this->l('Enable'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l('Save')));
     // loads current address for this supplier - if possible
     $address = null;
     if (isset($obj->id)) {
         $id_address = Address::getAddressIdBySupplierId($obj->id);
         if ($id_address > 0) {
             $address = new Address((int) $id_address);
         }
     }
     // force specific fields values (address)
     if ($address != null) {
         $this->fields_value = array('id_address' => $address->id, 'phone' => $address->phone, 'phone_mobile' => $address->phone_mobile, 'address' => $address->address1, 'address2' => $address->address2, 'postcode' => $address->postcode, 'city' => $address->city, 'id_country' => $address->id_country, 'id_state' => $address->id_state);
     } else {
         $this->fields_value = array('id_address' => 0, 'id_country' => Configuration::get('PS_COUNTRY_DEFAULT'));
     }
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso');
     }
     return parent::renderForm();
 }
 /**
  * AdminController::renderForm() override
  * @see AdminController::renderForm()
  */
 public function renderForm()
 {
     $current_profile = (int) $this->getCurrentProfileId();
     $profiles = Profile::getProfiles($this->context->language->id);
     $tabs = Tab::getTabs($this->context->language->id);
     $accesses = array();
     foreach ($profiles as $profile) {
         $accesses[$profile['id_profile']] = Profile::getProfileAccesses($profile['id_profile']);
     }
     // Deleted id_tab that do not have access
     foreach ($tabs as $key => $tab) {
         // Don't allow permissions for unnamed tabs (ie. AdminLogin)
         if (empty($tab['name'])) {
             unset($tabs[$key]);
         }
         foreach ($this->accesses_black_list as $id_tab) {
             if ($tab['id_tab'] == (int) $id_tab) {
                 unset($tabs[$key]);
             }
         }
     }
     $modules = array();
     foreach ($profiles as $profile) {
         $modules[$profile['id_profile']] = Module::getModulesAccessesByIdProfile($profile['id_profile']);
         uasort($modules[$profile['id_profile']], array($this, 'sortModuleByName'));
     }
     $this->fields_form = array('');
     $this->tpl_form_vars = array('profiles' => $profiles, 'accesses' => $accesses, 'id_tab_parentmodule' => (int) Tab::getIdFromClassName('AdminParentModules'), 'id_tab_module' => (int) Tab::getIdFromClassName('AdminModules'), 'tabs' => $this->displayTabs($tabs), 'current_profile' => (int) $current_profile, 'admin_profile' => (int) _PS_ADMIN_PROFILE_, 'access_edit' => $this->access('edit'), 'perms' => array('view', 'add', 'edit', 'delete'), 'modules' => $modules, 'link' => $this->context->link);
     return parent::renderForm();
 }
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Addresses'), 'icon' => 'icon-envelope-alt'), 'input' => array(array('type' => 'text_customer', 'label' => $this->l('Customer'), 'name' => 'id_customer', 'required' => false), array('type' => 'text', 'label' => $this->l('Identification Number'), 'name' => 'dni', 'required' => false, 'col' => '4', 'hint' => $this->l('DNI / NIF / NIE')), array('type' => 'text', 'label' => $this->l('Floor'), 'name' => 'floor', 'required' => true, 'col' => '4', 'hint' => $this->l('Floor')), array('type' => 'text', 'label' => $this->l('Lift'), 'name' => 'lift', 'required' => true, 'col' => '4', 'hint' => $this->l('Lift')), array('type' => 'text', 'label' => $this->l('Code_intercom'), 'name' => 'code_intercom', 'required' => false, 'col' => '4', 'hint' => $this->l('Code_intercom')), array('type' => 'text', 'label' => $this->l('Address alias'), 'name' => 'alias', 'required' => true, 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' &lt;&gt;;=#{}'), array('type' => 'textarea', 'label' => $this->l('Other'), 'name' => 'other', 'required' => false, 'cols' => 15, 'rows' => 3, 'hint' => $this->l('Forbidden characters:') . ' &lt;&gt;;=#{}')), 'submit' => array('title' => $this->l('Save')));
     $id_customer = (int) Tools::getValue('id_customer');
     if (!$id_customer && Validate::isLoadedObject($this->object)) {
         $id_customer = $this->object->id_customer;
     }
     if ($id_customer) {
         $customer = new Customer((int) $id_customer);
         $token_customer = Tools::getAdminToken('AdminCustomers' . (int) Tab::getIdFromClassName('AdminCustomers') . (int) $this->context->employee->id);
     }
     $this->tpl_form_vars = array('customer' => isset($customer) ? $customer : null, 'tokenCustomer' => isset($token_customer) ? $token_customer : null);
     // Order address fields depending on country format
     $addresses_fields = $this->processAddressFormat();
     // we use  delivery address
     $addresses_fields = $addresses_fields['dlv_all_fields'];
     // get required field
     $required_fields = AddressFormat::getFieldsRequired();
     // Merge with field required
     $addresses_fields = array_unique(array_merge($addresses_fields, $required_fields));
     $temp_fields = array();
     foreach ($addresses_fields as $addr_field_item) {
         if ($addr_field_item == 'company') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Company'), 'name' => 'company', 'required' => in_array('company', $required_fields), 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' &lt;&gt;;=#{}');
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('VAT number'), 'col' => '2', 'name' => 'vat_number', 'required' => in_array('vat_number', $required_fields));
         } elseif ($addr_field_item == 'lastname') {
             if (isset($customer) && !Tools::isSubmit('submit' . strtoupper($this->table)) && Validate::isLoadedObject($customer) && !Validate::isLoadedObject($this->object)) {
                 $default_value = $customer->lastname;
             } else {
                 $default_value = '';
             }
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Last Name'), 'name' => 'lastname', 'required' => in_array('lastname', $required_fields), 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' 0-9!&amp;lt;&amp;gt;,;?=+()@#"�{}_$%:', 'default_value' => $default_value);
         } elseif ($addr_field_item == 'firstname') {
             if (isset($customer) && !Tools::isSubmit('submit' . strtoupper($this->table)) && Validate::isLoadedObject($customer) && !Validate::isLoadedObject($this->object)) {
                 $default_value = $customer->firstname;
             } else {
                 $default_value = '';
             }
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('First Name'), 'name' => 'firstname', 'required' => in_array('firstname', $required_fields), 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' 0-9!&amp;lt;&amp;gt;,;?=+()@#"�{}_$%:', 'default_value' => $default_value);
         } elseif ($addr_field_item == 'address1') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Address'), 'name' => 'address1', 'col' => '6', 'required' => in_array('address1', $required_fields));
         } elseif ($addr_field_item == 'address2') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Address') . ' (2)', 'name' => 'address2', 'col' => '6', 'required' => in_array('address2', $required_fields));
         } elseif ($addr_field_item == 'postcode') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Zip/Postal Code'), 'name' => 'postcode', 'col' => '2', 'required' => in_array('postcode', $required_fields));
         } elseif ($addr_field_item == 'city') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('City'), 'name' => 'city', 'col' => '4', 'required' => in_array('city', $required_fields));
         } elseif ($addr_field_item == 'country' || $addr_field_item == 'Country:name') {
             $temp_fields[] = array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'required' => in_array('Country:name', $required_fields) || in_array('country', $required_fields), 'col' => '4', 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id), 'id' => 'id_country', 'name' => 'name'));
             $temp_fields[] = array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'required' => false, 'col' => '4', 'options' => array('query' => array(), 'id' => 'id_state', 'name' => 'name'));
         } elseif ($addr_field_item == 'phone') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Home phone'), 'name' => 'phone', 'required' => in_array('phone', $required_fields) || Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'col' => '4', 'hint' => Configuration::get('PS_ONE_PHONE_AT_LEAST') ? sprintf($this->l('You must register at least one phone number.')) : '');
         } elseif ($addr_field_item == 'phone_mobile') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Mobile phone'), 'name' => 'phone_mobile', 'required' => in_array('phone_mobile', $required_fields) || Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'col' => '4', 'hint' => Configuration::get('PS_ONE_PHONE_AT_LEAST') ? sprintf($this->l('You must register at least one phone number.')) : '');
         }
     }
     // merge address format with the rest of the form
     array_splice($this->fields_form['input'], 3, 0, $temp_fields);
     return AdminController::renderForm();
 }
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Contacts'), 'icon' => 'icon-envelope-alt'), 'input' => array(array('type' => 'text', 'label' => $this->l('Title'), 'name' => 'name', 'required' => true, 'lang' => true, 'col' => 4, 'hint' => $this->l('Contact name (e.g. Customer Support).')), array('type' => 'text', 'label' => $this->l('Email address'), 'name' => 'email', 'required' => false, 'col' => 4, 'hint' => $this->l('Emails will be sent to this address.')), array('type' => 'switch', 'label' => $this->l('Save messages?'), 'name' => 'customer_service', 'required' => false, 'class' => 't', 'is_bool' => true, 'hint' => $this->l('If enabled, all messages will be saved in the "Customer Service" page under the "Customer" menu.'), 'values' => array(array('id' => 'customer_service_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'customer_service_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'description', 'required' => false, 'lang' => true, 'col' => 6, 'hint' => $this->l('Further information regarding this contact.'))), 'submit' => array('title' => $this->l('Save')));
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso');
     }
     return parent::renderForm();
 }
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Contacts'), 'image' => '../img/admin/contact.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Title:'), 'name' => 'name', 'size' => 33, 'required' => true, 'lang' => true, 'desc' => $this->l('Contact name (e.g. Technical Support)')), array('type' => 'text', 'label' => $this->l('E-mail address'), 'name' => 'email', 'size' => 33, 'required' => false, 'desc' => $this->l('E-mails will be sent to this address')), array('type' => 'radio', 'label' => $this->l('Save messages?'), 'name' => 'customer_service', 'required' => false, 'class' => 't', 'is_bool' => true, 'desc' => $this->l('If enabled, all messages will be saved in the "Customer Service" page under the "Customer" menu'), 'values' => array(array('id' => 'customer_service_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'customer_service_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'description', 'required' => false, 'lang' => true, 'cols' => 36, 'rows' => 5, 'desc' => $this->l('Additional information about this contact'))), 'submit' => array('title' => $this->l('   Save   '), 'class' => 'button'));
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
     }
     return parent::renderForm();
 }
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Ingredients:'), 'image' => '../img/admin/delivery.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name:'), 'name' => 'name', 'lang' => true, 'size' => 40, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Price:'), 'name' => 'price', 'lang' => false, 'size' => 40, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Max amount:'), 'name' => 'max_amount', 'size' => 40, 'required' => true)), 'submit' => array('title' => $this->l('Save'), 'class' => 'btn btn-default pull-right'));
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     return parent::renderForm();
 }
 public function renderForm()
 {
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Tag')), 'input' => array(array('type' => 'text', 'label' => $this->l('Name:'), 'name' => 'name', 'required' => true), array('type' => 'select', 'label' => $this->l('Language:'), 'name' => 'id_lang', 'required' => true, 'options' => array('query' => Language::getLanguages(false), 'id' => 'id_lang', 'name' => 'name'))), 'selects' => array('products' => $obj->getProducts(true), 'products_unselected' => $obj->getProducts(false)), 'submit' => array('title' => $this->l('Save   '), 'class' => 'button'));
     return parent::renderForm();
 }
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Currencies:'), 'image' => '../img/admin/money.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Currency name:'), 'name' => 'name', 'size' => 30, 'maxlength' => 32, 'required' => true, 'hint' => $this->l('Only letters and the minus character are allowed')), array('type' => 'text', 'label' => $this->l('ISO code:'), 'name' => 'iso_code', 'size' => 30, 'maxlength' => 32, 'required' => true, 'desc' => $this->l('ISO code (e.g. USD for Dollars, EUR for Euros)') . '...'), array('type' => 'text', 'label' => $this->l('Numeric ISO code:'), 'name' => 'iso_code_num', 'size' => 30, 'maxlength' => 32, 'required' => true, 'desc' => $this->l('Numeric ISO code (e.g. 840 for Dollars, 978 for Euros)') . '...'), array('type' => 'text', 'label' => $this->l('Symbol:'), 'name' => 'sign', 'size' => 3, 'maxlength' => 8, 'required' => true, 'desc' => $this->l('Will appear in Front Office (e.g. $, €)') . '...'), array('type' => 'text', 'label' => $this->l('Conversion rate:'), 'name' => 'conversion_rate', 'size' => 3, 'maxlength' => 11, 'required' => true, 'desc' => $this->l('Conversion rate from one unit of your shop\'s default currency (for example, 1€) to this currency. For example, if the default currency is euros and this currency is dollars, type \'1.20\'') . ' 1&euro; = $1.20'), array('type' => 'select', 'label' => $this->l('Formatting:'), 'name' => 'format', 'size' => 3, 'maxlength' => 11, 'required' => true, 'desc' => $this->l('Applies to all prices, e.g.') . ' $1,240.15', 'options' => array('query' => array(array('key' => 1, 'name' => 'X0,000.00 (' . $this->l('as with Dollars') . ')'), array('key' => 2, 'name' => '0 000,00X (' . $this->l('as with Euros') . ')'), array('key' => 3, 'name' => 'X0.000,00'), array('key' => 4, 'name' => '0,000.00X'), array('key' => 5, 'name' => '0 000.00X')), 'name' => 'name', 'id' => 'key')), array('type' => 'radio', 'label' => $this->l('Decimals:'), 'name' => 'decimals', 'required' => false, 'class' => 't', 'is_bool' => true, 'desc' => $this->l('Display decimals in prices'), 'values' => array(array('id' => 'decimals_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'decimals_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Spacing:'), 'name' => 'blank', 'required' => false, 'class' => 't', 'is_bool' => true, 'desc' => $this->l('Include a space between symbol and price, e.g.') . '<br />$1,240.15 -> $ 1,240.15', 'values' => array(array('id' => 'blank_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'blank_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Enable:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))));
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
     }
     $this->fields_form['submit'] = array('title' => $this->l('   Save   '), 'class' => 'button');
     return parent::renderForm();
 }
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Titles'), 'image' => '../img/admin/tab-genders.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name:'), 'name' => 'name', 'lang' => true, 'size' => 33, 'hint' => $this->l('Invalid characters:') . ' 0-9!<>,;?=+()@#"�{}_$%:', 'required' => true), array('type' => 'radio', 'label' => $this->l('Type:'), 'name' => 'type', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'type_male', 'value' => 0, 'label' => $this->l('Male')), array('id' => 'type_female', 'value' => 1, 'label' => $this->l('Female')), array('id' => 'type_neutral', 'value' => 2, 'label' => $this->l('Neutral')))), array('type' => 'file', 'label' => $this->l('Image:'), 'name' => 'image', 'value' => true), array('type' => 'text', 'label' => $this->l('Image Width:'), 'name' => 'img_width', 'size' => 4, 'desc' => $this->l('Image width in pixels. Enter "0" to use the original size.')), array('type' => 'text', 'label' => $this->l('Image Height:'), 'name' => 'img_height', 'size' => 4, 'desc' => $this->l('Image height in pixels. Enter "0" to use the original size.'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $this->fields_value = array('img_width' => $this->default_image_width, 'img_height' => $this->default_image_height, 'image' => $obj->getImage());
     return parent::renderForm();
 }
Beispiel #18
0
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Zones'), 'icon' => 'icon-globe'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'required' => true, 'hint' => $this->l('Zone name (e.g. Africa, West Coast, Neighboring Countries).')), array('type' => 'switch', 'label' => $this->l('Active'), 'name' => 'active', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'hint' => $this->l('Allow or disallow shipping to this zone.'))));
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso');
     }
     $this->fields_form['submit'] = array('title' => $this->l('Save'));
     return parent::renderForm();
 }
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Zones'), 'image' => '../img/admin/world.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'size' => 33, 'required' => true, 'desc' => $this->l('Zone name (e.g. Africa, West Coast, Neighboring Countries)')), array('type' => 'radio', 'label' => $this->l('Active:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('Allow or disallow shipping to this zone'))));
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Group shop association:'), 'name' => 'checkBoxShopAsso');
     }
     $this->fields_form['submit'] = array('title' => $this->l('Save   '), 'class' => 'button');
     return parent::renderForm();
 }
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Currencies'), 'icon' => 'icon-money'), 'input' => array(array('type' => 'text', 'label' => $this->l('Currency name'), 'name' => 'name', 'size' => 30, 'maxlength' => 32, 'required' => true, 'hint' => $this->l('Only letters and the minus character are allowed.')), array('type' => 'text', 'label' => $this->l('ISO code'), 'name' => 'iso_code', 'maxlength' => 32, 'required' => true, 'hint' => $this->l('ISO code (e.g. USD for Dollars, EUR for Euros, etc.).')), array('type' => 'text', 'label' => $this->l('Numeric ISO code'), 'name' => 'iso_code_num', 'maxlength' => 32, 'required' => true, 'hint' => $this->l('Numeric ISO code (e.g. 840 for Dollars, 978 for Euros, etc.).')), array('type' => 'text', 'label' => $this->l('Symbol'), 'name' => 'sign', 'maxlength' => 8, 'required' => true, 'hint' => $this->l('Will appear in front office (e.g. $, &euro;, etc.)')), array('type' => 'text', 'label' => $this->l('Exchange rate'), 'name' => 'conversion_rate', 'maxlength' => 11, 'required' => true, 'hint' => $this->l('Exchange rates are calculated from one unit of your shop\'s default currency. For example, if the default currency is euros and your chosen currency is dollars, type "1.20" (1&euro; = $1.20).')), array('type' => 'select', 'label' => $this->l('Currency format'), 'name' => 'format', 'maxlength' => 11, 'required' => true, 'hint' => $this->l('Applies to all prices (e.g. $1,240.15).'), 'options' => array('query' => array(array('key' => 1, 'name' => 'X0,000.00 (' . $this->l('Such as with Dollars') . ')'), array('key' => 2, 'name' => '0 000,00X (' . $this->l('Such as with Euros') . ')'), array('key' => 3, 'name' => 'X0.000,00'), array('key' => 4, 'name' => '0,000.00X'), array('key' => 5, 'name' => '0\'000.00X')), 'name' => 'name', 'id' => 'key')), array('type' => 'switch', 'label' => $this->l('Decimals'), 'name' => 'decimals', 'required' => false, 'is_bool' => true, 'hint' => $this->l('Display decimals in prices.'), 'values' => array(array('id' => 'decimals_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'decimals_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'switch', 'label' => $this->l('Spacing'), 'name' => 'blank', 'required' => false, 'is_bool' => true, 'hint' => $this->l('Include a space between symbol and price (e.g. $1,240.15 -> $ 1,240.15).'), 'values' => array(array('id' => 'blank_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'blank_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'switch', 'label' => $this->l('Enable'), 'name' => 'active', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))));
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso');
     }
     $this->fields_form['submit'] = array('title' => $this->l('Save'));
     return parent::renderForm();
 }
 public function renderForm()
 {
     $this->initFieldsForm();
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $this->tpl_form_vars['products'] = $obj->getProducts(true, $this->context->language->id, false, $this->context);
     return parent::renderForm();
 }
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Social titles'), 'icon' => 'icon-male'), 'input' => array(array('type' => 'text', 'label' => $this->l('Social title'), 'name' => 'name', 'lang' => true, 'col' => 4, 'hint' => $this->l('Invalid characters:') . ' 0-9!&lt;&gt;,;?=+()@#"�{}_$%:', 'required' => true), array('type' => 'radio', 'label' => $this->l('Gender'), 'name' => 'type', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'type_male', 'value' => 0, 'label' => $this->l('Male')), array('id' => 'type_female', 'value' => 1, 'label' => $this->l('Female')), array('id' => 'type_neutral', 'value' => 2, 'label' => $this->l('Neutral')))), array('type' => 'file', 'label' => $this->l('Image'), 'name' => 'image', 'col' => 6, 'value' => true), array('type' => 'text', 'label' => $this->l('Image width'), 'name' => 'img_width', 'col' => 2, 'hint' => $this->l('Image width in pixels. Enter "0" to use the original size.')), array('type' => 'text', 'label' => $this->l('Image height'), 'name' => 'img_height', 'col' => 2, 'hint' => $this->l('Image height in pixels. Enter "0" to use the original size.'))), 'submit' => array('title' => $this->l('Save')));
     /** @var Gender $obj */
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $this->fields_value = array('img_width' => $this->default_image_width, 'img_height' => $this->default_image_height, 'image' => $obj->getImage());
     return parent::renderForm();
 }
 public function renderForm()
 {
     $carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
     foreach ($carriers as $key => $carrier) {
         if ($carrier['is_free']) {
             unset($carriers[$key]);
         }
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Weight ranges'), 'image' => '../img/t/AdminRangeWeight.gif'), 'input' => array(array('type' => 'select', 'label' => $this->l('Carrier:'), 'name' => 'id_carrier', 'required' => false, 'desc' => $this->l('You can apply this range to a different carrier by selecting its name.'), 'options' => array('query' => $carriers, 'id' => 'id_carrier', 'name' => 'name'), 'empty_message' => '<div style="margin:5px 0 10px 0">' . $this->l('There is no carrier available for this weight range.') . '</div>'), array('type' => 'text', 'label' => $this->l('From:'), 'name' => 'delimiter1', 'size' => 5, 'required' => true, 'suffix' => Configuration::get('PS_WEIGHT_UNIT'), 'desc' => $this->l('Range start (included)')), array('type' => 'text', 'label' => $this->l('To:'), 'name' => 'delimiter2', 'size' => 5, 'required' => true, 'suffix' => Configuration::get('PS_WEIGHT_UNIT'), 'desc' => $this->l('Range end (excluded)'))), 'submit' => array('title' => $this->l('   Save   '), 'class' => 'button'));
     return parent::renderForm();
 }
 public function renderForm()
 {
     $carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
     foreach ($carriers as $key => $carrier) {
         if ($carrier['is_free']) {
             unset($carriers[$key]);
         }
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Weight ranges'), 'icon' => 'icon-suitcase'), 'input' => array(array('type' => 'select', 'label' => $this->l('Carrier'), 'name' => 'id_carrier', 'required' => false, 'hint' => $this->l('You can apply this range to a different carrier by selecting its name.'), 'options' => array('query' => $carriers, 'id' => 'id_carrier', 'name' => 'name'), 'empty_message' => '<p class="alert alert-block">' . $this->l('There is no carrier available for this weight range.') . '</p>'), array('type' => 'text', 'label' => $this->l('From'), 'name' => 'delimiter1', 'required' => true, 'suffix' => Configuration::get('PS_WEIGHT_UNIT'), 'hint' => $this->l('Start range (included).')), array('type' => 'text', 'label' => $this->l('To'), 'name' => 'delimiter2', 'required' => true, 'suffix' => Configuration::get('PS_WEIGHT_UNIT'), 'hint' => $this->l('End range (excluded).'))), 'submit' => array('title' => $this->l('   Save   '), 'class' => 'btn btn-default'));
     return parent::renderForm();
 }
 public function renderForm()
 {
     if (($obj = $this->loadObject(true)) && Validate::isLoadedObject($obj)) {
         $link = $this->context->link->getPageLink('attachment', true, NULL, 'id_attachment=' . $obj->id);
         if (file_exists(_PS_DOWNLOAD_DIR_ . $obj->file)) {
             $size = round(filesize(_PS_DOWNLOAD_DIR_ . $obj->file) / 1024);
         }
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Attachment'), 'icon' => 'icon-paper-clip'), 'input' => array(array('type' => 'text', 'label' => $this->l('Filename:'), 'name' => 'name', 'required' => true, 'lang' => true, 'col' => 4), array('type' => 'textarea', 'label' => $this->l('Description:'), 'name' => 'description', 'lang' => true, 'col' => 6), array('type' => 'file', 'file' => isset($link) ? $link : null, 'size' => isset($size) ? $size : null, 'label' => $this->l('File:'), 'name' => 'file', 'col' => 6)), 'submit' => array('title' => $this->l('Save')));
     return parent::renderForm();
 }
 public function renderForm()
 {
     $currency = $this->context->currency;
     $carriers = Carrier::getCarriers((int) Configuration::get('PS_LANG_DEFAULT'), true, false, false, null, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
     foreach ($carriers as $key => $carrier) {
         if ($carrier['is_free']) {
             unset($carriers[$key]);
         }
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Price ranges'), 'icon' => 'icon-money'), 'input' => array(array('type' => 'select', 'label' => $this->l('Carrier'), 'name' => 'id_carrier', 'required' => false, 'hint' => $this->l('You can apply this range to a different carrier by selecting its name.'), 'options' => array('query' => $carriers, 'id' => 'id_carrier', 'name' => 'name'), 'empty_message' => '<p class="alert alert-block">' . $this->l('There is no carrier available for this price range.') . '</p>'), array('type' => 'text', 'label' => $this->l('From'), 'name' => 'delimiter1', 'required' => true, 'suffix' => $currency->getSign('right') . ' ' . $this->l('(Tax Incl.)'), 'hint' => $this->l('Start range (included).'), 'string_format' => '%.2f'), array('type' => 'text', 'label' => $this->l('To'), 'name' => 'delimiter2', 'required' => true, 'suffix' => $currency->getSign('right') . ' ' . $this->l('(Tax Incl.)'), 'hint' => $this->l('End range (excluded).'), 'string_format' => '%.2f')), 'submit' => array('title' => $this->trans('Save', array(), 'Admin.Actions'), 'class' => 'btn btn-default'));
     return parent::renderForm();
 }
 public function renderForm()
 {
     /** @var Shop $obj */
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $image = _PS_CITY_IMG_DIR_ . $obj->id . '.jpg';
     $image_url = ImageManager::thumbnail($image, $this->table . '_' . (int) $obj->id . '.' . $this->imageType, 350, $this->imageType, true, true);
     $image_size = file_exists($image) ? filesize($image) / 1000 : false;
     $this->fields_form = array('legend' => array('title' => $this->l('Città'), 'icon' => 'icon-globe'), 'input' => array(array('type' => 'text', 'label' => $this->l('Nome'), 'name' => 'name', 'maxlength' => 255, 'lang' => true, 'required' => true, 'hint' => $this->l('Indica il nome della città.')), array('type' => 'text', 'label' => $this->l('Codice ISTAT'), 'name' => 'iso_code', 'maxlength' => 255, 'required' => true, 'class' => 'uppercase', 'hint' => $this->l('Inserisci il codice alfanumerico ISTAT.')), array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'required' => true, 'default_value' => (int) Context::getContext()->country->id, 'options' => array('query' => Country::getCountries(Context::getContext()->language->id, false, true), 'id' => 'id_country', 'name' => 'name'), 'hint' => $this->l('Nazione della città.')), array('type' => 'text', 'label' => $this->l('Link rewrite'), 'name' => 'link_rewrite', 'maxlength' => 255, 'lang' => true, 'required' => true, 'havingFilter' => 'url', 'hint' => $this->l('URL della città.')), array('type' => 'file', 'label' => $this->l('Immagine'), 'name' => 'image', 'display_image' => true, 'image' => $image_url ? $image_url : false, 'size' => $image_size, 'hint' => $this->l('Storefront picture.')), array('type' => 'text', 'label' => $this->l('Legend'), 'name' => 'legend', 'maxlength' => 255, 'lang' => true, 'required' => true, 'hint' => $this->l("Didascalia dell'immagine"))), 'submit' => array('title' => $this->l('Save')));
     return parent::renderForm();
 }
 public function renderForm()
 {
     $currency = $this->context->currency;
     $carriers = Carrier::getCarriers((int) Configuration::get('PS_LANG_DEFAULT'), true, false, false, null, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
     foreach ($carriers as $key => $carrier) {
         if ($carrier['is_free']) {
             unset($carriers[$key]);
         }
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Price ranges'), 'image' => '../img/t/AdminRangePrice.gif'), 'input' => array(array('type' => 'select', 'label' => $this->l('Carrier:'), 'name' => 'id_carrier', 'required' => false, 'desc' => $this->l('You can apply this range to a different carrier by selecting its name.'), 'options' => array('query' => $carriers, 'id' => 'id_carrier', 'name' => 'name'), 'empty_message' => '<div style="margin:5px 0 10px 0">' . $this->l('There is no carrier available for this price range.') . '</div>'), array('type' => 'text', 'label' => $this->l('From:'), 'name' => 'delimiter1', 'size' => 5, 'required' => true, 'suffix' => $currency->getSign('right') . ' ' . $this->l('(Tax Incl.)'), 'desc' => $this->l('Start range (included)'), 'string_format' => '%.2f'), array('type' => 'text', 'label' => $this->l('To:'), 'name' => 'delimiter2', 'size' => 5, 'required' => true, 'suffix' => $currency->getSign('right') . ' ' . $this->l('(Tax Incl.)'), 'desc' => $this->l('End range (excluded)'), 'string_format' => '%.2f')), 'submit' => array('title' => $this->l('   Save   '), 'class' => 'button'));
     return parent::renderForm();
 }
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Carriers'), 'icon' => 'icon-truck'), 'input' => array(array('type' => 'text', 'label' => $this->l('Company'), 'name' => 'name', 'required' => true, 'hint' => array(sprintf($this->l('Allowed characters: letters, spaces and %s'), '().-'), $this->l('Carrier name displayed during checkout'), $this->l('For in-store pickup, enter 0 to replace the carrier name with your shop name.'))), array('type' => 'file', 'label' => $this->l('Logo'), 'name' => 'logo', 'hint' => $this->l('Upload a logo from your computer.') . ' (.gif, .jpg, .jpeg ' . $this->l('or') . ' .png)'), array('type' => 'text', 'label' => $this->l('Transit time'), 'name' => 'delay', 'lang' => true, 'required' => true, 'maxlength' => 128, 'hint' => $this->l('Estimated delivery time will be displayed during checkout.')), array('type' => 'text', 'label' => $this->l('Speed grade'), 'name' => 'grade', 'required' => false, 'hint' => $this->l('Enter "0" for a longest shipping delay, or "9" for the shortest shipping delay.')), array('type' => 'text', 'label' => $this->l('URL'), 'name' => 'url', 'hint' => $this->l('Delivery tracking URL: Type \'@\' where the tracking number should appear. It will then be automatically replaced by the tracking number.')), array('type' => 'checkbox', 'label' => $this->l('Zone'), 'name' => 'zone', 'values' => array('query' => Zone::getZones(false), 'id' => 'id_zone', 'name' => 'name'), 'hint' => $this->l('The zones in which this carrier will be used.')), array('type' => 'group', 'label' => $this->l('Group access'), 'name' => 'groupBox', 'values' => Group::getGroups(Context::getContext()->language->id), 'hint' => $this->l('Mark the groups that are allowed access to this carrier.')), array('type' => 'switch', 'label' => $this->l('Status'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'hint' => $this->l('Enable the carrier in the Front Office.')), array('type' => 'switch', 'label' => $this->l('Apply shipping cost'), 'name' => 'is_free', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'is_free_on', 'value' => 0, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />'), array('id' => 'is_free_off', 'value' => 1, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />')), 'hint' => $this->l('Apply both regular shipping cost and product-specific shipping costs.')), array('type' => 'select', 'label' => $this->l('Tax'), 'name' => 'id_tax_rules_group', 'options' => array('query' => TaxRulesGroup::getTaxRulesGroups(true), 'id' => 'id_tax_rules_group', 'name' => 'name', 'default' => array('label' => $this->l('No Tax'), 'value' => 0))), array('type' => 'switch', 'label' => $this->l('Shipping and handling'), 'name' => 'shipping_handling', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'shipping_handling_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'shipping_handling_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'hint' => $this->l('Include the shipping and handling costs in the carrier price.')), array('type' => 'radio', 'label' => $this->l('Billing'), 'name' => 'shipping_method', 'required' => false, 'class' => 't', 'br' => true, 'values' => array(array('id' => 'billing_default', 'value' => Carrier::SHIPPING_METHOD_DEFAULT, 'label' => $this->l('Default behavior')), array('id' => 'billing_price', 'value' => Carrier::SHIPPING_METHOD_PRICE, 'label' => $this->l('According to total price')), array('id' => 'billing_weight', 'value' => Carrier::SHIPPING_METHOD_WEIGHT, 'label' => $this->l('According to total weight')))), array('type' => 'select', 'label' => $this->l('Out-of-range behavior'), 'name' => 'range_behavior', 'options' => array('query' => array(array('id' => 0, 'name' => $this->l('Apply the cost of the highest defined range')), array('id' => 1, 'name' => $this->l('Disable carrier'))), 'id' => 'id', 'name' => 'name'), 'hint' => $this->l('Out-of-range behavior occurs when none is defined (e.g. when a customer\'s cart weight is greater than the highest range limit).')), array('type' => 'text', 'label' => $this->l('Maximum package height'), 'name' => 'max_height', 'required' => false, 'hint' => $this->l('Maximum height managed by this carrier. Set the value to "0," or leave this field blank to ignore.')), array('type' => 'text', 'label' => $this->l('Maximum package width'), 'name' => 'max_width', 'required' => false, 'hint' => $this->l('Maximum width managed by this carrier. Set the value to "0," or leave this field blank to ignore.')), array('type' => 'text', 'label' => $this->l('Maximum package depth'), 'name' => 'max_depth', 'required' => false, 'hint' => $this->l('Maximum depth managed by this carrier. Set the value to "0," or leave this field blank to ignore.')), array('type' => 'text', 'label' => $this->l('Maximum package weight'), 'name' => 'max_weight', 'required' => false, 'hint' => $this->l('Maximum weight managed by this carrier. Set the value to "0," or leave this field blank to ignore.')), array('type' => 'hidden', 'name' => 'is_module'), array('type' => 'hidden', 'name' => 'external_module_name'), array('type' => 'hidden', 'name' => 'shipping_external'), array('type' => 'hidden', 'name' => 'need_range')));
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso');
     }
     $this->fields_form['submit'] = array('title' => $this->l('Save'));
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $this->getFieldsValues($obj);
     return parent::renderForm();
 }
 public function renderForm()
 {
     $this->display = 'edit';
     $this->initToolbar();
     if (!($obj = $this->loadObject(TRUE))) {
         return;
     }
     $this->fields_form = array('tinymce' => TRUE, 'legend' => array('title' => $this->l('Static Block'), 'image' => '../img/admin/tab-categories.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Block Title:'), 'name' => 'title', 'id' => 'title', 'lang' => TRUE, 'required' => TRUE, 'size' => 50, 'maxlength' => 50), array('type' => 'text', 'label' => $this->l('Identifier:'), 'name' => 'block_identifier', 'id' => 'block_identifier', 'required' => TRUE, 'hint' => $this->l('Allowed characters:') . ' a-z, A-Z, 0-9, _', 'size' => 50, 'maxlength' => 50), array('type' => 'radio', 'label' => $this->l('Status:'), 'name' => 'status', 'required' => FALSE, 'class' => 't', 'is_bool' => TRUE, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'textarea', 'label' => $this->l('Content:'), 'name' => 'content', 'required' => TRUE, 'autoload_rte' => TRUE, 'lang' => TRUE, 'rows' => 5, 'cols' => 40)), 'submit' => array('title' => $this->l('   Save   '), 'class' => 'button'));
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
     }
     $this->tpl_form_vars = array('status' => $this->object->status);
     return parent::renderForm() . $this->_js;
 }