Пример #1
0
 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 __construct()
 {
     $this->className = 'Configuration';
     $this->table = 'configuration';
     parent::__construct();
     // List of CMS tabs
     $cms_tab = array(0 => array('id' => 0, 'name' => $this->l('None')));
     foreach (CMS::listCms($this->context->language->id) as $cms_file) {
         $cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']);
     }
     // List of order process types
     $order_process_type = array(array('value' => PS_ORDER_PROCESS_STANDARD, 'name' => $this->l('Standard (5 steps)')), array('value' => PS_ORDER_PROCESS_OPC, 'name' => $this->l('One page checkout')));
     $this->fields_options = array('general' => array('title' => $this->l('General'), 'icon' => 'tab-preferences', 'fields' => array('PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'desc' => $this->l('You can choose the order process type as either standard (5 steps) or One Page Checkout'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'desc' => $this->l('Guests can place an order without registering'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PURCHASE_MINIMUM' => array('title' => $this->l('Minimum purchase total required in order to validate order'), 'desc' => $this->l('Set to 0 to disable this feature'), 'validation' => 'isFloat', 'cast' => 'floatval', 'type' => 'price'), 'PS_ALLOW_MULTISHIPPING' => array('title' => $this->l('Allow multi-shipping'), 'desc' => $this->l('Allow the customer to ship his order to multiple addresses. This option will convert the customer\'s cart into one or more orders.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_SHIP_WHEN_AVAILABLE' => array('title' => $this->l('Delayed shipping'), 'desc' => $this->l('Allow the customer to split his order: one with the products currently "in stock", and another with the other products. This option will convert the customer\'s cart into two orders.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('Conditions of use CMS page'), 'desc' => $this->l('Choose the Conditions of use CMS page'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval'))), 'gift' => array('title' => $this->l('Gift options'), 'icon' => 'tab-preferences', 'fields' => array('PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift-wrapping'), 'desc' => $this->l('Suggest gift-wrapping to customer and possibility of leaving a message'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrapping price'), 'desc' => $this->l('Set a price for gift-wrapping'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX_RULES_GROUP' => array('title' => $this->l('Gift-wrapping tax'), 'desc' => $this->l('Set a tax for gift-wrapping'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => array_merge(array(array('id_tax_rules_group' => 0, 'name' => $this->l('None'))), TaxRulesGroup::getTaxRulesGroups(true)), 'identifier' => 'id_tax_rules_group'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging'), 'desc' => $this->l('Suggest recycled packaging to customer'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')), 'submit' => array('title' => $this->l('Save'), 'class' => 'button')));
 }
 public function __construct()
 {
     $this->bootstrap = true;
     $this->className = 'Configuration';
     $this->table = 'configuration';
     parent::__construct();
     // List of CMS tabs
     $cms_tab = array(0 => array('id' => 0, 'name' => $this->l('None')));
     foreach (CMS::listCms($this->context->language->id) as $cms_file) {
         $cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']);
     }
     // List of order process types
     $order_process_type = array(array('value' => PS_ORDER_PROCESS_STANDARD, 'name' => $this->l('Standard (Five steps)')), array('value' => PS_ORDER_PROCESS_OPC, 'name' => $this->l('One-page checkout')));
     $this->fields_options = array('general' => array('title' => $this->l('General'), 'icon' => 'icon-cogs', 'fields' => array('PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'hint' => $this->l('Please choose either the five-step or one-page checkout process.'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'hint' => $this->l('Allow guest visitors to place an order without registering.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_DISALLOW_HISTORY_REORDERING' => array('title' => $this->l('Disable Reordering Option'), 'hint' => $this->l('Disable the option to allow customers to reorder in one click from the order history page (required in some European countries).'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PURCHASE_MINIMUM' => array('title' => $this->l('Minimum purchase total required in order to validate the order'), 'hint' => $this->l('Set to 0 to disable this feature.'), 'validation' => 'isFloat', 'cast' => 'floatval', 'type' => 'price'), 'PS_ALLOW_MULTISHIPPING' => array('title' => $this->l('Allow multishipping'), 'hint' => $this->l('Allow the customer to ship orders to multiple addresses. This option will convert the customer\'s cart into one or more orders.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_SHIP_WHEN_AVAILABLE' => array('title' => $this->l('Delayed shipping'), 'hint' => $this->l('Allows you to delay shipping at your customers\' request. '), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'hint' => $this->l('Require customers to accept or decline terms of service before processing an order.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('CMS page for the Conditions of use'), 'hint' => $this->l('Choose the CMS page which contains your store\'s conditions of use.'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval')), 'submit' => array('title' => $this->l('Save'))), 'gift' => array('title' => $this->l('Gift options'), 'icon' => 'icon-gift', 'fields' => array('PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift wrapping'), 'hint' => $this->l('Suggest gift-wrapping to customers.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrapping price'), 'hint' => $this->l('Set a price for gift wrapping.'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX_RULES_GROUP' => array('title' => $this->l('Gift-wrapping tax'), 'hint' => $this->l('Set a tax for gift wrapping.'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => array_merge(array(array('id_tax_rules_group' => 0, 'name' => $this->l('None'))), TaxRulesGroup::getTaxRulesGroups(true)), 'identifier' => 'id_tax_rules_group'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging'), 'hint' => $this->l('Suggest recycled packaging to customer.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')), 'submit' => array('title' => $this->l('Save'))));
     if (!Configuration::get('PS_ALLOW_MULTISHIPPING')) {
         unset($this->fields_options['general']['fields']['PS_ALLOW_MULTISHIPPING']);
     }
 }
 public function __construct()
 {
     $this->bootstrap = true;
     $this->className = 'Configuration';
     $this->table = 'configuration';
     parent::__construct();
     // List of CMS tabs
     $cms_tab = array(0 => array('id' => 0, 'name' => $this->trans('None', array(), 'Admin.Global')));
     foreach (CMS::listCms($this->context->language->id) as $cms_file) {
         $cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']);
     }
     $this->fields_options = array('general' => array('title' => $this->trans('General', array(), 'Admin.Global'), 'icon' => 'icon-cogs', 'fields' => array('PS_FINAL_SUMMARY_ENABLED' => array('title' => $this->trans('Enable final summary', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Display an overview of the addresses, shipping method and cart just before the order button (required in some European countries).', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->trans('Enable guest checkout', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Allow guest visitors to place an order without registering.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_DISALLOW_HISTORY_REORDERING' => array('title' => $this->trans('Disable Reordering Option', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Disable the option to allow customers to reorder in one click from the order history page (required in some European countries).', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PURCHASE_MINIMUM' => array('title' => $this->trans('Minimum purchase total required in order to validate the order', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Set to 0 to disable this feature.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isFloat', 'cast' => 'floatval', 'type' => 'price'), 'PS_ORDER_RECALCULATE_SHIPPING' => array('title' => $this->trans('Recalculate shipping cost after order edition', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Automatically updates the shipping costs when you edit an order.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_ALLOW_MULTISHIPPING' => array('title' => $this->trans('Allow multishipping', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Allow the customer to ship orders to multiple addresses. This option will convert the customer\'s cart into one or more orders.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_SHIP_WHEN_AVAILABLE' => array('title' => $this->trans('Delayed shipping', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Allows you to delay shipping at your customers\' request.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->trans('Terms of service', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Require customers to accept or decline terms of service before processing an order.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->trans('Page for the Terms and conditions', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Choose the page which contains your store\'s terms and conditions of use.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval')), 'submit' => array('title' => $this->trans('Save', array(), 'Admin.Actions'))), 'gift' => array('title' => $this->trans('Gift options', array(), 'Admin.ShopParameters.Feature'), 'icon' => 'icon-gift', 'fields' => array('PS_GIFT_WRAPPING' => array('title' => $this->trans('Offer gift wrapping', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Suggest gift-wrapping to customers.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->trans('Gift-wrapping price', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Set a price for gift wrapping.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX_RULES_GROUP' => array('title' => $this->trans('Gift-wrapping tax', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Set a tax for gift wrapping.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => array_merge(array(array('id_tax_rules_group' => 0, 'name' => $this->trans('None'))), TaxRulesGroup::getTaxRulesGroups(true)), 'identifier' => 'id_tax_rules_group'), 'PS_RECYCLABLE_PACK' => array('title' => $this->trans('Offer recycled packaging', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Suggest recycled packaging to customer.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')), 'submit' => array('title' => $this->trans('Save', array(), 'Admin.Actions'))));
     if (!Configuration::get('PS_ALLOW_MULTISHIPPING')) {
         unset($this->fields_options['general']['fields']['PS_ALLOW_MULTISHIPPING']);
     }
     if (Configuration::get('PS_ATCP_SHIPWRAP')) {
         unset($this->fields_options['gift']['fields']['PS_GIFT_WRAPPING_TAX_RULES_GROUP']);
     }
 }
 /**
  * @return array an array of tax rules group formatted as $id => $name
  */
 public static function getTaxRulesGroupsForOptions()
 {
     $tax_rules[] = array('id_tax_rules_group' => 0, 'name' => Tools::displayError('No tax'));
     return array_merge($tax_rules, TaxRulesGroup::getTaxRulesGroups());
 }
Пример #6
0
 public function initFormPrices($obj)
 {
     $data = $this->createTemplate($this->tpl_form);
     $product = $obj;
     if ($obj->id) {
         $shops = Shop::getShops();
         $countries = Country::getCountries($this->context->language->id);
         $groups = Group::getGroups($this->context->language->id);
         $currencies = Currency::getCurrencies();
         $attributes = $obj->getAttributesGroups((int) $this->context->language->id);
         $combinations = array();
         foreach ($attributes as $attribute) {
             $combinations[$attribute['id_product_attribute']]['id_product_attribute'] = $attribute['id_product_attribute'];
             if (!isset($combinations[$attribute['id_product_attribute']]['attributes'])) {
                 $combinations[$attribute['id_product_attribute']]['attributes'] = '';
             }
             $combinations[$attribute['id_product_attribute']]['attributes'] .= $attribute['attribute_name'] . ' - ';
             $combinations[$attribute['id_product_attribute']]['price'] = Tools::displayPrice(Tools::convertPrice(Product::getPriceStatic((int) $obj->id, false, $attribute['id_product_attribute']), $this->context->currency), $this->context->currency);
         }
         foreach ($combinations as &$combination) {
             $combination['attributes'] = rtrim($combination['attributes'], ' - ');
         }
         $data->assign('specificPriceModificationForm', $this->_displaySpecificPriceModificationForm($this->context->currency, $shops, $currencies, $countries, $groups));
         $data->assign('ecotax_tax_excl', $obj->ecotax);
         $this->_applyTaxToEcotax($obj);
         $data->assign(array('shops' => $shops, 'admin_one_shop' => count($this->context->employee->getAssociatedShops()) == 1, 'currencies' => $currencies, 'countries' => $countries, 'groups' => $groups, 'combinations' => $combinations, 'multi_shop' => Shop::isFeatureActive(), 'link' => new Link()));
     } else {
         $this->displayWarning($this->l('You must save this product before adding specific pricing'));
         $product->id_tax_rules_group = (int) Product::getIdTaxRulesGroupMostUsed();
         $data->assign('ecotax_tax_excl', 0);
     }
     // prices part
     $data->assign(array('link' => $this->context->link, 'currency' => $currency = $this->context->currency, 'tax_rules_groups' => TaxRulesGroup::getTaxRulesGroups(true), 'taxesRatesByGroup' => TaxRulesGroup::getAssociatedTaxRatesByIdCountry($this->context->country->id), 'ecotaxTaxRate' => Tax::getProductEcotaxRate(), 'tax_exclude_taxe_option' => Tax::excludeTaxeOption(), 'ps_use_ecotax' => Configuration::get('PS_USE_ECOTAX')));
     $product->price = Tools::convertPrice($product->price, $this->context->currency, true, $this->context);
     if ($product->unit_price_ratio != 0) {
         $data->assign('unit_price', Tools::ps_round($product->price / $product->unit_price_ratio, 2));
     } else {
         $data->assign('unit_price', 0);
     }
     $data->assign('ps_tax', Configuration::get('PS_TAX'));
     $data->assign('country_display_tax_label', $this->context->country->display_tax_label);
     $data->assign(array('currency', $this->context->currency, 'product' => $product, 'token' => $this->token));
     $this->tpl_form_vars['custom_form'] = $data->fetch();
 }
Пример #7
0
    public function displayForm($isMainTab = true)
    {
        global $currentIndex, $cookie;
        parent::displayForm();
        if (!($obj = $this->loadObject(true))) {
            return;
        }
        $currentLanguage = (int) $cookie->id_lang;
        echo '<script type="text/javascript">
			$(document).ready(function(){
				// At the loading
				($("input[name=\'is_free\']:checked").val() == 0) ? $("#shipping_costs_div").show(): $("#shipping_costs_div").hide();
			
				$("input[name=\'is_free\']").live("change", function(){
					($("input[name=\'is_free\']:checked").val() == 0) ? $("#shipping_costs_div").show(): $("#shipping_costs_div").hide();			
				});
			});
		</script>
		<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post" enctype="multipart/form-data">
		' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . '
			<fieldset><legend><img src="../img/admin/delivery.gif" />' . $this->l('Carriers') . '</legend>
				<label>' . $this->l('Company:') . ' </label>
				<div class="margin-form">
					<input type="text" size="25" name="name" value="' . htmlentities($this->getFieldValue($obj, 'name'), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup>
					<span class="hint" name="help_box">' . $this->l('Allowed characters: letters, spaces and') . ' ().-<span class="hint-pointer">&nbsp;</span></span>
					<p class="clear">' . $this->l('Carrier name displayed during checkout') . '<br />' . $this->l('With a value of 0, the carrier name will be replaced by the shop name') . '</p>
				</div>
				<label>' . $this->l('Logo:') . ' </label>
				<div class="margin-form">
					<input type="file" name="logo" />
					<p>' . $this->l('Upload logo from your computer') . ' (.gif, .jpg, .jpeg ' . $this->l('or') . ' .png)</p>
				</div>
				<label>' . $this->l('Transit time:') . ' </label>
				<div class="margin-form">';
        foreach ($this->_languages as $language) {
            echo '
					<div id="delay_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
						<input type="text" size="41" maxlength="128" name="delay_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'delay', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup>
					</div>';
        }
        $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'delay', 'delay');
        echo '
					<p style="clear: both">' . $this->l('Time taken for product delivery; displayed during checkout') . '</p>
				</div>
				<label>' . $this->l('URL:') . ' </label>
				<div class="margin-form">
					<input type="text" size="40" name="url" value="' . htmlentities($this->getFieldValue($obj, 'url'), ENT_COMPAT, 'UTF-8') . '" />
					<p class="clear">' . $this->l('URL for the tracking number; type \'@\' where the tracking number will appear') . '</p>
				</div>
				<label>' . $this->l('Zone') . '</label>
				<div class="margin-form">';
        $carrier_zones = $obj->getZones();
        $carrier_zones_ids = array();
        if (is_array($carrier_zones)) {
            foreach ($carrier_zones as $carrier_zone) {
                $carrier_zones_ids[] = $carrier_zone['id_zone'];
            }
        }
        $zones = Zone::getZones(false);
        foreach ($zones as $zone) {
            echo '<input type="checkbox" id="zone_' . $zone['id_zone'] . '" name="zone_' . $zone['id_zone'] . '" value="true" ' . Tools::getValue('zone_' . $zone['id_zone'], in_array($zone['id_zone'], $carrier_zones_ids) ? ' checked="checked"' : '') . '>
							<label class="t" for="zone_' . $zone['id_zone'] . '"> <b>' . $zone['name'] . '</b></label><br />';
        }
        echo '<p>' . $this->l('The zone in which this carrier is to be used') . '</p>
				</div>
				<label>' . $this->l('Group access') . '</label>
				<div class="margin-form">';
        $groups = Group::getGroups((int) $cookie->id_lang);
        if (sizeof($groups)) {
            echo '
					<table cellspacing="0" cellpadding="0" class="table" style="width: 28em;">
						<tr>
							<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'groupBox[]\', this.checked)"' . (!isset($obj->id) ? 'checked="checked" ' : '') . ' /></th>
							<th>' . $this->l('ID') . '</th>
							<th>' . $this->l('Group name') . '</th>
						</tr>';
            $irow = 0;
            foreach ($groups as $group) {
                echo '
							<tr class="' . ($irow++ % 2 ? 'alt_row' : '') . '">
								<td><input type="checkbox" name="groupBox[]" class="groupBox" id="groupBox_' . $group['id_group'] . '" value="' . $group['id_group'] . '" ' . ((Db::getInstance()->getValue('SELECT id_group FROM ' . _DB_PREFIX_ . 'carrier_group WHERE id_carrier=' . (int) $obj->id . ' AND id_group=' . (int) $group['id_group']) or !isset($obj->id)) ? 'checked="checked" ' : '') . '/></td>
								<td>' . $group['id_group'] . '</td>
								<td><label for="groupBox_' . $group['id_group'] . '" class="t">' . $group['name'] . '</label></td>
							</tr>';
            }
            echo '
					</table>
					<p style="padding:0px; margin:10px 0px 10px 0px;">' . $this->l('Mark all groups you want to give access to this carrier') . '</p>
					';
        } else {
            echo '<p>' . $this->l('No group created') . '</p>';
        }
        echo '				</div>
				<label>' . $this->l('Status:') . ' </label>
				<div class="margin-form">
					<input type="radio" name="active" id="active_on" value="1" ' . ($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label>
					<input type="radio" name="active" id="active_off" value="0" ' . (!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label>
					<p>' . $this->l('Include or exclude carrier from list of carriers on Front Office') . '</p>
				</div>
				<label>' . $this->l('Apply shipping cost:') . ' </label>
				<div class="margin-form">
					<input type="radio" name="is_free" id="is_free_on" value="0" ' . (!$this->getFieldValue($obj, 'is_free') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" /></label>
					<input type="radio" name="is_free" id="is_free_off" value="1" ' . ($this->getFieldValue($obj, 'is_free') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" /></label>
					<p>' . $this->l('Apply shipping costs and additional shipping costs by products in carrier price') . '</p>
				</div>
				<div id="shipping_costs_div">
				<label>' . $this->l('Tax') . '</label>
				<div class="margin-form">
					 <select name="id_tax_rules_group" id="id_tax_rules_group" ' . (Tax::excludeTaxeOption() ? 'disabled="disabled"' : '') . '>
					    <option value="0">' . $this->l('No Tax') . '</option>';
        foreach (TaxRulesGroup::getTaxRulesGroups(true) as $tax_rules_group) {
            echo '<option value="' . $tax_rules_group['id_tax_rules_group'] . '" ' . ($this->getFieldValue($obj, 'id_tax_rules_group') == $tax_rules_group['id_tax_rules_group'] ? ' selected="selected"' : '') . '>' . $tax_rules_group['name'] . '</option>';
        }
        echo '</select>
				</div>
				<label>' . $this->l('Shipping & handling:') . ' </label>
				<div class="margin-form">
					<input type="radio" name="shipping_handling" id="shipping_handling_on" value="1" ' . ($this->getFieldValue($obj, 'shipping_handling') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="shipping_handling_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label>
					<input type="radio" name="shipping_handling" id="shipping_handling_off" value="0" ' . (!$this->getFieldValue($obj, 'shipping_handling') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="shipping_handling_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label>
					<p>' . $this->l('Include the shipping & handling costs in carrier price') . '</p>
				</div>
				<label>' . $this->l('Billing:') . ' </label>
				<div class="margin-form">
					<input type="radio" name="shipping_method" id="billing_default" value="' . Carrier::SHIPPING_METHOD_DEFAULT . '" ' . ($this->getFieldValue($obj, 'shipping_method') == Carrier::SHIPPING_METHOD_DEFAULT ? 'checked="checked" ' : '') . '/>
					<label class="t" for="billing_default">' . $this->l('Default behavior') . '</label><br />
					<input type="radio" name="shipping_method" id="billing_price" value="' . Carrier::SHIPPING_METHOD_PRICE . '" ' . ($this->getFieldValue($obj, 'shipping_method') == Carrier::SHIPPING_METHOD_PRICE ? 'checked="checked" ' : '') . '/>
					<label class="t" for="billing_price">' . $this->l('According to total price') . '</label><br />
					<input type="radio" name="shipping_method" id="billing_weight" value="' . Carrier::SHIPPING_METHOD_WEIGHT . '" ' . ($this->getFieldValue($obj, 'shipping_method') == Carrier::SHIPPING_METHOD_WEIGHT ? 'checked="checked" ' : '') . '/>
					<label class="t" for="billing_weight">' . $this->l('According to total weight') . '</label><br />
				</div>
				<label>' . $this->l('Out-of-range behavior:') . ' </label>
				<div class="margin-form">
					<select name="range_behavior">
						<option value="0"' . (!$this->getFieldValue($obj, 'range_behavior') ? ' selected="selected"' : '') . '>' . $this->l('Apply the cost of the highest defined range') . '</option>
						<option value="1"' . ($this->getFieldValue($obj, 'range_behavior') ? ' selected="selected"' : '') . '>' . $this->l('Disable carrier') . '</option>
					</select>
					<p>' . $this->l('Out-of-range behavior when none is defined (e.g., when a customer\'s cart weight is greater than the highest range limit)') . '</p>
				</div>';
        if ($this->getFieldValue($obj, 'is_module')) {
            echo '<label>' . $this->l('Module:') . ' </label>
						  <div class="margin-form"><p> - ' . $this->l('This carrier is bound to this module ') . ' => ' . $this->getFieldValue($obj, 'external_module_name') . '</p>
						  <input type="hidden" name="is_module" value="1">
						  <input type="hidden" name="external_module_name" value="' . $this->getFieldValue($obj, 'external_module_name') . '">';
            if ($this->getFieldValue($obj, 'shipping_external')) {
                echo '<p> - ' . $this->l('The shipping costs are calculated outside of your shop') . '</p>
						<input type="hidden" name="shipping_external" value="1">';
            }
            if ($this->getFieldValue($obj, 'need_range')) {
                echo '<p> - ' . $this->l('This carrier uses PrestaShop range to calculate shipping costs') . '</p>
						<input type="hidden" name="need_range" value="1">';
            }
            echo '</div>';
        }
        echo '</div>
				<div class="margin-form">
					<input type="submit" value="' . $this->l('   Save   ') . '" name="submitAdd' . $this->table . '" class="button" />
				</div>
				<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
			</fieldset>
		</form>';
    }
 public function renderStepThree($carrier)
 {
     $this->fields_form = array('form' => array('id_form' => 'step_carrier_ranges', 'input' => array('shipping_handling' => array('type' => 'switch', 'label' => $this->trans('Add handling costs', array(), 'Admin.Shipping.Feature'), 'name' => 'shipping_handling', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'shipping_handling_on', 'value' => 1, 'label' => $this->trans('Enabled', array(), 'Admin.Global')), array('id' => 'shipping_handling_off', 'value' => 0, 'label' => $this->trans('Disabled', array(), 'Admin.Global'))), 'hint' => $this->trans('Include the handling costs (as set in Shipping > Preferences) in the final carrier price.', array(), 'Admin.Shipping.Help')), 'is_free' => array('type' => 'switch', 'label' => $this->trans('Free shipping', array(), 'Admin.Shipping.Feature'), 'name' => 'is_free', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'is_free_on', 'value' => 1, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->trans('No', array(), 'Admin.Global') . '" title="' . $this->trans('No', array(), 'Admin.Global') . '" />'), array('id' => 'is_free_off', 'value' => 0, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->trans('Yes', array(), 'Admin.Global') . '" title="' . $this->trans('Yes', array(), 'Admin.Global') . '" />'))), 'shipping_method' => array('type' => 'radio', 'label' => $this->trans('Billing', array(), 'Admin.Shipping.Feature'), 'name' => 'shipping_method', 'required' => false, 'class' => 't', 'br' => true, 'values' => array(array('id' => 'billing_price', 'value' => Carrier::SHIPPING_METHOD_PRICE, 'label' => $this->trans('According to total price.', array(), 'Admin.Shipping.Feature')), array('id' => 'billing_weight', 'value' => Carrier::SHIPPING_METHOD_WEIGHT, 'label' => $this->trans('According to total weight.', array(), 'Admin.Shipping.Feature')))), 'id_tax_rules_group' => array('type' => 'select', 'label' => $this->trans('Tax', array(), 'Admin.Global'), 'name' => 'id_tax_rules_group', 'options' => array('query' => TaxRulesGroup::getTaxRulesGroups(true), 'id' => 'id_tax_rules_group', 'name' => 'name', 'default' => array('label' => $this->trans('No tax', array(), 'Admin.Global'), 'value' => 0))), 'range_behavior' => array('type' => 'select', 'label' => $this->trans('Out-of-range behavior', array(), 'Admin.Shipping.Feature'), 'name' => 'range_behavior', 'options' => array('query' => array(array('id' => 0, 'name' => $this->trans('Apply the cost of the highest defined range', array(), 'Admin.Shipping.Feature')), array('id' => 1, 'name' => $this->trans('Disable carrier', array(), 'Admin.Shipping.Feature'))), 'id' => 'id', 'name' => 'name'), 'hint' => $this->trans('Out-of-range behavior occurs when no defined range matches the customer\'s cart (e.g. when the weight of the cart is greater than the highest weight limit defined by the weight ranges).', array(), 'Admin.Shipping.Help')), 'zones' => array('type' => 'zone', 'name' => 'zones'))));
     if (Configuration::get('PS_ATCP_SHIPWRAP')) {
         unset($this->fields_form['form']['input']['id_tax_rules_group']);
     }
     $tpl_vars = array();
     $tpl_vars['PS_WEIGHT_UNIT'] = Configuration::get('PS_WEIGHT_UNIT');
     $currency = $this->getActualCurrency();
     $tpl_vars['currency_sign'] = $currency->sign;
     $fields_value = $this->getStepThreeFieldsValues($carrier);
     $this->getTplRangesVarsAndValues($carrier, $tpl_vars, $fields_value);
     return $this->renderGenericForm(array('form' => $this->fields_form), $fields_value, $tpl_vars);
 }
Пример #9
0
    function displayFormInformations($obj, $currency)
    {
        parent::displayForm(false);
        global $currentIndex, $cookie, $link;
        $default_country = new Country((int) Configuration::get('PS_COUNTRY_DEFAULT'));
        $iso = Language::getIsoById((int) $cookie->id_lang);
        $has_attribute = false;
        $qty_state = 'readonly';
        $qty = Attribute::getAttributeQty($this->getFieldValue($obj, 'id_product'));
        if ($qty === false) {
            if (Validate::isLoadedObject($obj)) {
                $qty = $this->getFieldValue($obj, 'quantity');
            } else {
                $qty = 1;
            }
            $qty_state = '';
        } else {
            $has_attribute = true;
        }
        $cover = Product::getCover($obj->id);
        $this->_applyTaxToEcotax($obj);
        echo '
		<div class="tab-page" id="step1">
			<h4 class="tab">1. ' . $this->l('Info.') . '</h4>
			<script type="text/javascript">
				$(document).ready(function() {
					updateCurrentText();
					updateFriendlyURL();
					$.ajax({
						url: "' . dirname($currentIndex) . '/ajax.php",
						cache: false,
						dataType: "json",
						data: "ajaxProductManufacturers=1",
						success: function(j) {
							var options = $("select#id_manufacturer").html();
							if (j)
							for (var i = 0; i < j.length; i++)
								options += \'<option value="\' + j[i].optionValue + \'">\' + j[i].optionDisplay + \'</option>\';
							$("select#id_manufacturer").html(options);
						},
						error: function(XMLHttpRequest, textStatus, errorThrown)
						{
							alert(\'Manufacturer ajax error: \'+textStatus);
						}

					});
					$.ajax({
						url: "' . dirname($currentIndex) . '/ajax.php",
						cache: false,
						dataType: "json",
						data: "ajaxProductSuppliers=1",
						success: function(j) {
							var options = $("select#id_supplier").html();
							if (j)
							for (var i = 0; i < j.length; i++)
								options += \'<option value="\' + j[i].optionValue + \'">\' + j[i].optionDisplay + \'</option>\';
							$("select#id_supplier").html(options);
						},
						error: function(XMLHttpRequest, textStatus, errorThrown)
						{
							alert(\'Supplier ajax error: \'+textStatus);
						}

					});
					if ($(\'#available_for_order\').is(\':checked\')){
						$(\'#show_price\').attr(\'checked\', \'checked\');
						$(\'#show_price\').attr(\'disabled\', \'disabled\');
					}
					else {
						$(\'#show_price\').attr(\'disabled\', \'\');
					}
				});
			</script>
			<b>' . $this->l('Product global information') . '</b>&nbsp;-&nbsp;';
        $preview_url = '';
        if (isset($obj->id)) {
            $preview_url = $link->getProductLink($this->getFieldValue($obj, 'id'), $this->getFieldValue($obj, 'link_rewrite', $this->_defaultFormLanguage), Category::getLinkRewrite($this->getFieldValue($obj, 'id_category_default'), (int) $cookie->id_lang));
            if (!$obj->active) {
                $admin_dir = dirname($_SERVER['PHP_SELF']);
                $admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
                $token = Tools::encrypt('PreviewProduct' . $obj->id);
                $preview_url .= $obj->active ? '' : '&adtoken=' . $token . '&ad=' . $admin_dir;
            }
            echo '
			<a href="index.php?tab=AdminCatalog&id_product=' . $obj->id . '&deleteproduct&token=' . $this->token . '" style="float:right;"
			onclick="return confirm(\'' . $this->l('Are you sure?', __CLASS__, true, false) . '\');">
			<img src="../img/admin/delete.gif" alt="' . $this->l('Delete this product') . '" title="' . $this->l('Delete this product') . '" /> ' . $this->l('Delete this product') . '</a>
			<a href="' . $preview_url . '" target="_blank"><img src="../img/admin/details.gif" alt="' . $this->l('View product in shop') . '" title="' . $this->l('View product in shop') . '" /> ' . $this->l('View product in shop') . '</a>';
            if (file_exists(_PS_MODULE_DIR_ . 'statsproduct/statsproduct.php')) {
                echo '&nbsp;-&nbsp;<a href="index.php?tab=AdminStats&module=statsproduct&id_product=' . $obj->id . '&token=' . Tools::getAdminToken('AdminStats' . (int) Tab::getIdFromClassName('AdminStats') . (int) $cookie->id_employee) . '"><img src="../modules/statsproduct/logo.gif" alt="' . $this->l('View product sales') . '" title="' . $this->l('View product sales') . '" /> ' . $this->l('View product sales') . '</a>';
            }
        }
        echo '
			<hr class="clear"/>
			<br />
				<table cellpadding="5" style="width: 50%; float: left; margin-right: 20px; border-right: 1px solid #E0D0B1;">
					<tr>
						<td class="col-left">' . $this->l('Name:') . '</td>
						<td style="padding-bottom:5px;" class="translatable">';
        foreach ($this->_languages as $language) {
            echo '		<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
								<input size="43" type="text" id="name_' . $language['id_lang'] . '" name="name_' . $language['id_lang'] . '"
								value="' . stripslashes(htmlspecialchars($this->getFieldValue($obj, 'name', $language['id_lang']))) . '"' . (!$obj->id ? ' onkeyup="if (isArrowKey(event)) return; copy2friendlyURL();"' : '') . ' onkeyup="if (isArrowKey(event)) return; updateCurrentText();" onchange="updateCurrentText();" /><sup> *</sup>
								<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
							</div>';
        }
        echo '		</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Reference:') . '</td>
						<td style="padding-bottom:5px;">
							<input size="55" type="text" name="reference" value="' . htmlentities($this->getFieldValue($obj, 'reference'), ENT_COMPAT, 'UTF-8') . '" style="width: 130px; margin-right: 44px;" />
							<span class="hint" name="help_box">' . $this->l('Special characters allowed:') . ' .-_#\\<span class="hint-pointer">&nbsp;</span></span>
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Supplier Reference:') . '</td>
						<td style="padding-bottom:5px;">
							<input size="55" type="text" name="supplier_reference" value="' . htmlentities($this->getFieldValue($obj, 'supplier_reference'), ENT_COMPAT, 'UTF-8') . '" style="width: 130px; margin-right: 44px;" />
							<span class="hint" name="help_box">' . $this->l('Special characters allowed:') . ' .-_#\\<span class="hint-pointer">&nbsp;</span></span>
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('EAN13 or JAN:') . '</td>
						<td style="padding-bottom:5px;">
							<input size="55" maxlength="13" type="text" name="ean13" value="' . htmlentities($this->getFieldValue($obj, 'ean13'), ENT_COMPAT, 'UTF-8') . '" style="width: 130px; margin-right: 5px;" /> <span class="small">' . $this->l('(Europe, Japan)') . '</span>
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('UPC:') . '</td>
						<td style="padding-bottom:5px;">
							<input size="55" maxlength="12" type="text" name="upc" value="' . htmlentities($this->getFieldValue($obj, 'upc'), ENT_COMPAT, 'UTF-8') . '" style="width: 130px; margin-right: 5px;" /> <span class="small">' . $this->l('(US, Canada)') . '</span>
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Location (warehouse):') . '</td>
						<td style="padding-bottom:5px;">
							<input size="55" type="text" name="location" value="' . htmlentities($this->getFieldValue($obj, 'location'), ENT_COMPAT, 'UTF-8') . '" style="width: 130px; margin-right: 44px;" />
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Width ( package ) :') . '</td>
						<td style="padding-bottom:5px;">
							<input size="6" maxlength="6" name="width" type="text" value="' . htmlentities($this->getFieldValue($obj, 'width'), ENT_COMPAT, 'UTF-8') . '" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\');" /> ' . Configuration::get('PS_DIMENSION_UNIT') . '
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Height ( package ) :') . '</td>
						<td style="padding-bottom:5px;">
							<input size="6" maxlength="6" name="height" type="text" value="' . htmlentities($this->getFieldValue($obj, 'height'), ENT_COMPAT, 'UTF-8') . '" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\');" /> ' . Configuration::get('PS_DIMENSION_UNIT') . '
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Deep ( package ) :') . '</td>
						<td style="padding-bottom:5px;">
							<input size="6" maxlength="6" name="depth" type="text" value="' . htmlentities($this->getFieldValue($obj, 'depth'), ENT_COMPAT, 'UTF-8') . '" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\');" /> ' . Configuration::get('PS_DIMENSION_UNIT') . '
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Weight ( package ) :') . '</td>
						<td style="padding-bottom:5px;">
							<input size="6" maxlength="6" name="weight" type="text" value="' . htmlentities($this->getFieldValue($obj, 'weight'), ENT_COMPAT, 'UTF-8') . '" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\');" /> ' . Configuration::get('PS_WEIGHT_UNIT') . '
						</td>
					</tr>
				</table>
				<table cellpadding="5" style="width: 40%; float: left; margin-left: 10px;">
					<tr>
						<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Status:') . '</td>
						<td style="padding-bottom:5px;">
							<input style="float:left;" onclick="toggleDraftWarning(false);showOptions(true);" type="radio" name="active" id="active_on" value="1" ' . ($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
							<label for="active_on" class="t"><img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" style="float:left; padding:0px 5px 0px 5px;" />' . $this->l('Enabled') . '</label>
							<br class="clear" />
							<input style="float:left;" onclick="toggleDraftWarning(true);showOptions(false);"  type="radio" name="active" id="active_off" value="0" ' . (!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
							<label for="active_off" class="t"><img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('Disabled') . ($obj->active ? '' : ' (<a href="' . $preview_url . '" alt="" target="_blank">' . $this->l('View product in shop') . '</a>)') . '</label>
						</td>
					</tr>
					<tr id="product_options" ' . (!$obj->active ? 'style="display:none"' : '') . '>
						<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Options:') . '</td>
						<td style="padding-bottom:5px;">
							<input style="float: left;" type="checkbox" name="available_for_order" id="available_for_order" value="1" ' . ($this->getFieldValue($obj, 'available_for_order') ? 'checked="checked" ' : '') . ' onclick="if ($(this).is(\':checked\')){$(\'#show_price\').attr(\'checked\', \'checked\');$(\'#show_price\').attr(\'disabled\', \'disabled\');}else{$(\'#show_price\').attr(\'disabled\', \'\');}"/>
							<label for="available_for_order" class="t"><img src="../img/admin/products.gif" alt="' . $this->l('available for order') . '" title="' . $this->l('available for order') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('available for order') . '</label>
							<br class="clear" />
							<input style="float: left;" type="checkbox" name="show_price" id="show_price" value="1" ' . ($this->getFieldValue($obj, 'show_price') ? 'checked="checked" ' : '') . ' />
							<label for="show_price" class="t"><img src="../img/admin/gold.gif" alt="' . $this->l('display price') . '" title="' . $this->l('show price') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('show price') . '</label>
							<br class="clear" />
							<input style="float: left;" type="checkbox" name="online_only" id="online_only" value="1" ' . ($this->getFieldValue($obj, 'online_only') ? 'checked="checked" ' : '') . ' />
							<label for="online_only" class="t"><img src="../img/admin/basket_error.png" alt="' . $this->l('online only') . '" title="' . $this->l('online only') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('online only (not sold in store)') . '</label>
						</td>
					</tr>
					<tr>
						<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Condition:') . '</td>
						<td style="padding-bottom:5px;">
							<select name="condition" id="condition">
								<option value="new" ' . ($obj->condition == 'new' ? 'selected="selected"' : '') . '>' . $this->l('New') . '</option>
								<option value="used" ' . ($obj->condition == 'used' ? 'selected="selected"' : '') . '>' . $this->l('Used') . '</option>
								<option value="refurbished" ' . ($obj->condition == 'refurbished' ? 'selected="selected"' : '') . '>' . $this->l('Refurbished') . '</option>
							</select>
						</td>
					</tr>
					<tr>
						<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Manufacturer:') . '</td>
						<td style="padding-bottom:5px;">
							<select name="id_manufacturer" id="id_manufacturer">
								<option value="0">-- ' . $this->l('Choose (optional)') . ' --</option>';
        if ($id_manufacturer = $this->getFieldValue($obj, 'id_manufacturer')) {
            echo '				<option value="' . $id_manufacturer . '" selected="selected">' . Manufacturer::getNameById($id_manufacturer) . '</option>
								<option disabled="disabled">----------</option>';
        }
        echo '
							</select>&nbsp;&nbsp;&nbsp;<a href="?tab=AdminManufacturers&addmanufacturer&token=' . Tools::getAdminToken('AdminManufacturers' . (int) Tab::getIdFromClassName('AdminManufacturers') . (int) $cookie->id_employee) . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete product information entered?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="' . $this->l('Create') . '" title="' . $this->l('Create') . '" /> <b>' . $this->l('Create') . '</b></a>
						</td>
					</tr>
					<tr>
						<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Supplier:') . '</td>
						<td style="padding-bottom:5px;">
							<select name="id_supplier" id="id_supplier">
								<option value="0">-- ' . $this->l('Choose (optional)') . ' --</option>';
        if ($id_supplier = $this->getFieldValue($obj, 'id_supplier')) {
            echo '				<option value="' . $id_supplier . '" selected="selected">' . Supplier::getNameById($id_supplier) . '</option>
								<option disabled="disabled">----------</option>';
        }
        echo '
							</select>&nbsp;&nbsp;&nbsp;<a href="?tab=AdminSuppliers&addsupplier&token=' . Tools::getAdminToken('AdminSuppliers' . (int) Tab::getIdFromClassName('AdminSuppliers') . (int) $cookie->id_employee) . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="' . $this->l('Create') . '" title="' . $this->l('Create') . '" /> <b>' . $this->l('Create') . '</b></a>
						</td>
					</tr>
				</table>
				<div class="clear"></div>
				<table cellpadding="5" style="width: 100%;">
					<tr><td colspan="2"><hr style="width:100%;" /></td></tr>';
        $this->displayPack($obj);
        echo '		<tr><td colspan="2"><hr style="width:100%;" /></td></tr>';
        /*
         * Form for add a virtual product like software, mp3, etc...
         */
        $productDownload = new ProductDownload();
        if ($id_product_download = $productDownload->getIdFromIdProduct($this->getFieldValue($obj, 'id'))) {
            $productDownload = new ProductDownload($id_product_download);
        }
        ?>
	<script type="text/javascript">
	// <![CDATA[
		ThickboxI18nImage = '<?php 
        echo $this->l('Image');
        ?>
';
		ThickboxI18nOf = '<?php 
        echo $this->l('of');
        ?>
';
		ThickboxI18nClose = '<?php 
        echo $this->l('Close');
        ?>
';
		ThickboxI18nOrEscKey = '<?php 
        echo $this->l('(or "Esc")');
        ?>
';
		ThickboxI18nNext = '<?php 
        echo $this->l('Next >');
        ?>
';
		ThickboxI18nPrev = '<?php 
        echo $this->l('< Previous');
        ?>
';
		tb_pathToImage = '../img/loadingAnimation.gif';
	//]]>
	</script>
	<script type="text/javascript" src="<?php 
        echo _PS_JS_DIR_;
        ?>
jquery/thickbox-modified.js"></script>
	<script type="text/javascript" src="<?php 
        echo _PS_JS_DIR_;
        ?>
jquery/ajaxfileupload.js"></script>
	<script type="text/javascript" src="<?php 
        echo _PS_JS_DIR_;
        ?>
date.js"></script>
	<style type="text/css">
		<!--
		@import url(<?php 
        echo _PS_CSS_DIR_;
        ?>
thickbox.css);
		-->
	</style>
	<script type="text/javascript">
	//<![CDATA[
	function toggleVirtualProduct(elt)
	{
		if (elt.checked)
		{
			$('#virtual_good').show('slow');
			$('#virtual_good_more').show('slow');
			getE('out_of_stock_1').checked = 'checked';
			getE('out_of_stock_2').disabled = 'disabled';
			getE('out_of_stock_3').disabled = 'disabled';
			getE('label_out_of_stock_2').setAttribute('for', '');
			getE('label_out_of_stock_3').setAttribute('for', '');
		}
		else
		{
			$('#virtual_good').hide('slow');
			$('#virtual_good_more').hide('slow');
			getE('out_of_stock_2').disabled = false;
			getE('out_of_stock_3').disabled = false;
			getE('label_out_of_stock_2').setAttribute('for', 'out_of_stock_2');
			getE('label_out_of_stock_3').setAttribute('for', 'out_of_stock_3');
		}
	}

	function uploadFile()
	{
		$.ajaxFileUpload (
			{
				url:'./uploadProductFile.php',
				secureuri:false,
				fileElementId:'virtual_product_file',
				dataType: 'xml',

				success: function (data, status)
				{
					data = data.getElementsByTagName('return')[0];
					var result = data.getAttribute("result");
					var msg = data.getAttribute("msg");
					var fileName = data.getAttribute("filename");

					if (result == "error")
					{
						$("#upload-confirmation").html('<p>error: ' + msg + '</p>');
					}
					else
					{
						$('#virtual_product_file').remove();
						$('#virtual_product_file_label').hide();
						$('#file_missing').hide();
						new_href = $('#delete_downloadable_product').attr('href').replace('%26deleteVirtualProduct%3Dtrue', '%26file%3D'+msg+'%26deleteVirtualProduct%3Dtrue');
						$('#delete_downloadable_product').attr('href', new_href);
						$('#delete_downloadable_product').show();
						$('#virtual_product_name').attr('value', fileName);
						$('#upload-confirmation').html(
							'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'"><?php 
        echo $this->l('The file');
        ?>
&nbsp;"' + fileName + '"&nbsp;<?php 
        echo $this->l('has successfully been uploaded');
        ?>
</a>' +
							'<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" />');
					}
				}
			}
		);
	}

	//]]>
	</script>
	<?php 
        echo '
		<script type="text/javascript" src="../js/price.js"></script>
		<script type="text/javascript">
			var newLabel = \'' . $this->l('New label') . '\';
			var choose_language = \'' . $this->l('Choose language:') . '\';
			var required = \'' . $this->l('required') . '\';
			var customizationUploadableFileNumber = ' . (int) $this->getFieldValue($obj, 'uploadable_files') . ';
			var customizationTextFieldNumber = ' . (int) $this->getFieldValue($obj, 'text_fields') . ';
			var uploadableFileLabel = 0;
			var textFieldLabel = 0;
		</script>';
        ?>
	<tr>
		<td colspan="2">
			<p><input type="checkbox" id="is_virtual_good" name="is_virtual_good" value="true" onclick="toggleVirtualProduct(this);" <?php 
        if (($productDownload->id or Tools::getValue('is_virtual_good') == 'true') and $productDownload->active) {
            echo 'checked="checked"';
        }
        ?>
 />
			<label for="is_virtual_good" class="t bold" style="color: black;"><?php 
        echo $this->l('Is this a downloadable product?');
        ?>
</label></p>
			<div id="virtual_good" <?php 
        if (!$productDownload->id or !$productDownload->active) {
            echo 'style="display:none;"';
        }
        ?>
 >
	<?php 
        if (!ProductDownload::checkWritableDir()) {
            ?>
		<p class="alert">
			<?php 
            echo $this->l('Your download repository is not writable.');
            ?>
<br/>
			<?php 
            echo realpath(_PS_DOWNLOAD_DIR_);
            ?>
		</p>
	<?php 
        } else {
            ?>
			<?php 
            if ($productDownload->id) {
                echo '<input type="hidden" id="virtual_product_id" name="virtual_product_id" value="' . $productDownload->id . '" />';
            }
            ?>
				<p class="block">
	<?php 
            if (!$productDownload->checkFile()) {
                ?>

				<div style="padding:5px;width:50%;float:left;margin-right:20px;border-right:1px solid #E0D0B1">
		<?php 
                if ($productDownload->id) {
                    ?>
					<p class="alert" id="file_missing">
						<?php 
                    echo $this->l('This product is missing');
                    ?>
:<br/>
						<?php 
                    echo realpath(_PS_DOWNLOAD_DIR_) . '/' . $productDownload->physically_filename;
                    ?>
					</p>
		<?php 
                }
                ?>
					<p><?php 
                $max_upload = (int) ini_get('upload_max_filesize');
                $max_post = (int) ini_get('post_max_size');
                $upload_mb = min($max_upload, $max_post);
                echo $this->l('Your server\'s maximum upload file size is') . ':&nbsp;' . $upload_mb . $this->l('Mb');
                ?>
</p>
					<?php 
                if (!strval(Tools::getValue('virtual_product_filename'))) {
                    ?>
					<label id="virtual_product_file_label" for="virtual_product_file" class="t"><?php 
                    echo $this->l('Upload a file');
                    ?>
</label>
					<p><input type="file" id="virtual_product_file" name="virtual_product_file" onchange="uploadFile();" /></p>
					<?php 
                }
                ?>
					<div id="upload-confirmation">
					<?php 
                if ($up_filename = strval(Tools::getValue('virtual_product_filename'))) {
                    ?>
						<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="<?php 
                    echo $up_filename;
                    ?>
" />
					<?php 
                }
                ?>
					</div>
					<a id="delete_downloadable_product" style="display:none;" href="confirm.php?height=200&amp;width=300&amp;modal=true&amp;referer=<?php 
                echo rawurlencode($_SERVER['REQUEST_URI'] . '&deleteVirtualProduct=true');
                ?>
" class="thickbox red" title="<?php 
                echo $this->l('Delete this file');
                ?>
"><?php 
                echo $this->l('Delete this file');
                ?>
</a>
	<?php 
            } else {
                ?>
					<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="<?php 
                echo $productDownload->physically_filename;
                ?>
" />
					<?php 
                echo $this->l('This is the link') . ':&nbsp;' . $productDownload->getHtmlLink(false, true);
                ?>
					<a href="confirm.php?height=200&amp;width=300&amp;modal=true&amp;referer=<?php 
                echo rawurlencode($_SERVER['REQUEST_URI'] . '&deleteVirtualProduct=true');
                ?>
" class="thickbox red" title="<?php 
                echo $this->l('Delete this file');
                ?>
"><?php 
                echo $this->l('Delete this file');
                ?>
</a>
	<?php 
            }
            // check if file exists
            ?>
				</p>
				<p class="block">
					<label for="virtual_product_name" class="t"><?php 
            echo $this->l('Filename');
            ?>
</label>
					<input type="text" id="virtual_product_name" name="virtual_product_name" style="width:200px" value="<?php 
            echo $productDownload->id > 0 ? $productDownload->display_filename : htmlentities(Tools::getValue('virtual_product_name'), ENT_COMPAT, 'UTF-8');
            ?>
" />
					<span class="hint" name="help_box" style="display:none;"><?php 
            echo $this->l('The full filename with its extension (e.g., Book.pdf)');
            ?>
</span>
				</p>

				</div>
				<div id="virtual_good_more" style="<?php 
            if (!$productDownload->id or !$productDownload->active) {
                echo 'display:none;';
            }
            ?>
padding:5px;width:40%;float:left;margin-left:10px">

				<p class="block">
					<label for="virtual_product_nb_downloable" class="t"><?php 
            echo $this->l('Number of downloads');
            ?>
</label>
					<input type="text" id="virtual_product_nb_downloable" name="virtual_product_nb_downloable" value="<?php 
            echo $productDownload->id > 0 ? $productDownload->nb_downloadable : htmlentities(Tools::getValue('virtual_product_nb_downloable'), ENT_COMPAT, 'UTF-8');
            ?>
" class="" size="6" />
					<span class="hint" name="help_box" style="display:none"><?php 
            echo $this->l('Number of authorized downloads per customer');
            ?>
</span>
				</p>
				<p class="block">
					<label for="virtual_product_expiration_date" class="t"><?php 
            echo $this->l('Expiration date');
            ?>
</label>
					<input type="text" id="virtual_product_expiration_date" name="virtual_product_expiration_date" value="<?php 
            echo $productDownload->id > 0 ? (!empty($productDownload->date_expiration) and $productDownload->date_expiration != '0000-00-00 00:00:00') ? date('Y-m-d', strtotime($productDownload->date_expiration)) : '' : htmlentities(Tools::getValue('virtual_product_expiration_date'), ENT_COMPAT, 'UTF-8');
            ?>
" size="11" maxlength="10" autocomplete="off" /> <?php 
            echo $this->l('Format: YYYY-MM-DD');
            ?>
					<span class="hint" name="help_box" style="display:none"><?php 
            echo $this->l('No expiration date if you leave this blank');
            ?>
</span>
				</p>
				<p class="block">
					<label for="virtual_product_nb_days" class="t"><?php 
            echo $this->l('Number of days');
            ?>
</label>
					<input type="text" id="virtual_product_nb_days" name="virtual_product_nb_days" value="<?php 
            echo $productDownload->id > 0 ? $productDownload->nb_days_accessible : htmlentities(Tools::getValue('virtual_product_nb_days'), ENT_COMPAT, 'UTF-8');
            ?>
" class="" size="4" /><sup> *</sup>
					<span class="hint" name="help_box" style="display:none"><?php 
            echo $this->l('How many days this file can be accessed by customers');
            ?>
 - <em>(<?php 
            echo $this->l('set to zero for unlimited access');
            ?>
)</em></span>
				</p>
				</div>
	<?php 
        }
        // check if download directory is writable
        ?>
			</div>
		</td>
	</tr>
	<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
	<script type="text/javascript">
		if ($('#is_virtual_good').attr('checked'))
		{
			$('#virtual_good').show('slow');
			$('#virtual_good_more').show('slow');
		}
	</script>

<?php 
        echo '
					<tr>
						<td class="col-left">' . $this->l('Pre-tax wholesale price:') . '</td>
						<td style="padding-bottom:5px;">
							' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<input size="11" maxlength="14" name="wholesale_price" type="text" value="' . htmlentities($this->getFieldValue($obj, 'wholesale_price'), ENT_COMPAT, 'UTF-8') . '" onchange="this.value = this.value.replace(/,/g, \'.\');" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '
							<span style="margin-left:10px">' . $this->l('The wholesale price at which you bought this product') . '</span>
						</td>
					</tr>';
        echo '
					<tr>
						<td class="col-left">' . $this->l('Pre-tax retail price:') . '</td>
						<td style="padding-bottom:5px;">
							' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<input size="11" maxlength="14" id="priceTE" name="price" type="text" value="' . htmlentities($this->getFieldValue($obj, 'price'), ENT_COMPAT, 'UTF-8') . '" onchange="this.value = this.value.replace(/,/g, \'.\');" onkeyup="if (isArrowKey(event)) return; calcPriceTI();" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '<sup> *</sup>
							<span style="margin-left:2px">' . $this->l('The pre-tax retail price to sell this product') . '</span>
						</td>
					</tr>';
        $tax_rules_groups = TaxRulesGroup::getTaxRulesGroups(true);
        $taxesRatesByGroup = TaxRulesGroup::getAssociatedTaxRatesByIdCountry(Country::getDefaultCountryId());
        $ecotaxTaxRate = Tax::getProductEcotaxRate();
        echo '<script type="text/javascript">';
        echo 'noTax = ' . (Tax::excludeTaxeOption() ? 'true' : 'false'), ";\n";
        echo 'taxesArray = new Array ();' . "\n";
        echo 'taxesArray[0] = 0', ";\n";
        foreach ($tax_rules_groups as $tax_rules_group) {
            $tax_rate = array_key_exists($tax_rules_group['id_tax_rules_group'], $taxesRatesByGroup) ? $taxesRatesByGroup[$tax_rules_group['id_tax_rules_group']] : 0;
            echo 'taxesArray[' . $tax_rules_group['id_tax_rules_group'] . ']=' . $tax_rate . "\n";
        }
        echo '
						ecotaxTaxRate = ' . $ecotaxTaxRate / 100 . ';
					</script>';
        echo '
					<tr>
						<td class="col-left">' . $this->l('Tax rule:') . '</td>
						<td style="padding-bottom:5px;">
					<span ' . (Tax::excludeTaxeOption() ? 'style="display:none;"' : '') . '>
					 <select onChange="javascript:calcPriceTI(); unitPriceWithTax(\'unit\');" name="id_tax_rules_group" id="id_tax_rules_group" ' . (Tax::excludeTaxeOption() ? 'disabled="disabled"' : '') . '>
						 <option value="0">' . $this->l('No Tax') . '</option>';
        foreach ($tax_rules_groups as $tax_rules_group) {
            echo '<option value="' . $tax_rules_group['id_tax_rules_group'] . '" ' . ($this->getFieldValue($obj, 'id_tax_rules_group') == $tax_rules_group['id_tax_rules_group'] ? ' selected="selected"' : '') . '>' . Tools::htmlentitiesUTF8($tax_rules_group['name']) . '</option>';
        }
        echo '</select>

				<a href="?tab=AdminTaxRulesGroup&addtax_rules_group&token=' . Tools::getAdminToken('AdminTaxRulesGroup' . (int) Tab::getIdFromClassName('AdminTaxRulesGroup') . (int) $cookie->id_employee) . '&id_product=' . (int) $obj->id . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="' . $this->l('Create') . '" title="' . $this->l('Create') . '" /> <b>' . $this->l('Create') . '</b></a></span>
				';
        if (Tax::excludeTaxeOption()) {
            echo '<span style="margin-left:10px; color:red;">' . $this->l('Taxes are currently disabled') . '</span> (<b><a href="index.php?tab=AdminTaxes&token=' . Tools::getAdminToken('AdminTaxes' . (int) Tab::getIdFromClassName('AdminTaxes') . (int) $cookie->id_employee) . '">' . $this->l('Tax options') . '</a></b>)';
            echo '<input type="hidden" value="' . (int) $this->getFieldValue($obj, 'id_tax_rules_group') . '" name="id_tax_rules_group" />';
        }
        echo '</td>
					</tr>
				';
        if (Configuration::get('PS_USE_ECOTAX')) {
            echo '
					<tr>
						<td class="col-left">' . $this->l('Eco-tax (tax incl.):') . '</td>
						<td style="padding-bottom:5px;">
							' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<input size="11" maxlength="14" id="ecotax" name="ecotax" type="text" value="' . $this->getFieldValue($obj, 'ecotax') . '" onkeyup="if (isArrowKey(event))return; calcPriceTE(); this.value = this.value.replace(/,/g, \'.\'); if (parseInt(this.value) > getE(\'priceTE\').value) this.value = getE(\'priceTE\').value; if (isNaN(this.value)) this.value = 0;" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '
							<span style="margin-left:10px">(' . $this->l('already included in price') . ')</span>
						</td>
					</tr>';
        }
        if ($default_country->display_tax_label) {
            echo '
						<tr ' . (Tax::excludeTaxeOption() ? 'style="display:none"' : '') . '>
							<td class="col-left">' . $this->l('Retail price with tax:') . '</td>
							<td style="padding-bottom:5px;">
								' . ($currency->format % 2 != 0 ? ' ' . $currency->sign : '') . ' <input size="11" maxlength="14" id="priceTI" type="text" value="" onchange="noComma(\'priceTI\');" onkeyup="if (isArrowKey(event)) return;  calcPriceTE();" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '
							</td>
						</tr>';
        } else {
            echo '<input size="11" maxlength="14" id="priceTI" type="hidden" value="" onchange="noComma(\'priceTI\');" onkeyup="if (isArrowKey(event)) return;  calcPriceTE();" />';
        }
        echo '
					<tr id="tr_unit_price">
						<td class="col-left">' . $this->l('Unit price without tax:') . '</td>
						<td style="padding-bottom:5px;">
							' . ($currency->format % 2 != 0 ? ' ' . $currency->sign : '') . ' <input size="11" maxlength="14" id="unit_price" name="unit_price" type="text" value="' . ($this->getFieldValue($obj, 'unit_price_ratio') != 0 ? Tools::ps_round($this->getFieldValue($obj, 'price') / $this->getFieldValue($obj, 'unit_price_ratio'), 2) : 0) . '" onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\'); unitPriceWithTax(\'unit\');"/>' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . ' ' . $this->l('per') . ' <input size="6" maxlength="10" id="unity" name="unity" type="text" value="' . (Validate::isCleanHtml($this->getFieldValue($obj, 'unity')) ? htmlentities($this->getFieldValue($obj, 'unity'), ENT_QUOTES, 'UTF-8') : '') . '" onkeyup="if (isArrowKey(event)) return ;unitySecond();" onchange="unitySecond();"/>' . (Configuration::get('PS_TAX') && $default_country->display_tax_label ? '<span style="margin-left:15px">' . $this->l('or') . ' ' . ($currency->format % 2 != 0 ? ' ' . $currency->sign : '') . '<span id="unit_price_with_tax">0.00</span>' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . ' ' . $this->l('per') . ' <span id="unity_second">' . (Validate::isCleanHtml($this->getFieldValue($obj, 'unity')) ? htmlentities($this->getFieldValue($obj, 'unity'), ENT_QUOTES, 'UTF-8') : '') . '</span> ' . $this->l('with tax') : '') . '</span>
							<p>' . $this->l('Eg. $15 per Lb') . '</p>
						</td>
					</tr>
					<tr>
						<td class="col-left">&nbsp;</td>
						<td style="padding-bottom:5px;">
							<input type="checkbox" name="on_sale" id="on_sale" style="padding-top: 5px;" ' . ($this->getFieldValue($obj, 'on_sale') ? 'checked="checked"' : '') . 'value="1" />&nbsp;<label for="on_sale" class="t">' . $this->l('Display "on sale" icon on product page and text on product listing') . '</label>
						</td>
					</tr>
					<tr>
						<td class="col-left"><b>' . $this->l('Final retail price:') . '</b></td>
						<td style="padding-bottom:5px;">
							<span style="' . ($default_country->display_tax_label ? '' : 'display:none') . '">
							' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<span id="finalPrice" style="font-weight: bold;"></span>' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '<span' . (!Configuration::get('PS_TAX') ? ' style="display:none;"' : '') . '> (' . $this->l('tax incl.') . ')</span>
							</span>
							<span' . (!Configuration::get('PS_TAX') ? ' style="display:none;"' : '') . '>';
        if ($default_country->display_tax_label) {
            echo ' / ';
        }
        echo ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<span id="finalPriceWithoutTax" style="font-weight: bold;"></span>' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . ' ' . ($default_country->display_tax_label ? '(' . $this->l('tax excl.') . ')' : '') . '</span>
						</td>
					</tr>
					<tr>
						<td class="col-left">&nbsp;</td>
						<td>
							<div class="hint clear" style="display: block;width: 70%;">' . $this->l('You can define many discounts and specific price rules in the Prices tab') . '</div>
						</td>
					</tr>
					<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>';
        if ((int) Configuration::get('PS_STOCK_MANAGEMENT')) {
            if (!$has_attribute) {
                if ($obj->id) {
                    echo '
							<tr><td class="col-left">' . $this->l('Stock Movement:') . '</td>
								<td style="padding-bottom:5px;">
									<select id="id_mvt_reason" name="id_mvt_reason">
										<option value="-1">--</option>';
                    $reasons = StockMvtReason::getStockMvtReasons((int) $cookie->id_lang);
                    foreach ($reasons as $reason) {
                        echo '<option rel="' . $reason['sign'] . '" value="' . $reason['id_stock_mvt_reason'] . '" ' . (Configuration::get('PS_STOCK_MVT_REASON_DEFAULT') == $reason['id_stock_mvt_reason'] ? 'selected="selected"' : '') . '>' . $reason['name'] . '</option>';
                    }
                    echo '</select>
									<input id="mvt_quantity" type="text" name="mvt_quantity" size="3" maxlength="10" value="0"/>&nbsp;&nbsp;
									<span style="display:none;" id="mvt_sign"></span>
								</td>
							</tr>
							<tr>
								<td class="col-left">&nbsp;</td>
								<td>
									<div class="hint clear" style="display: block;width: 70%;">' . $this->l('Choose the reason and enter the quantity that you want to increase or decrease in your stock') . '</div>
								</td>
							</tr>';
                } else {
                    echo '<tr><td class="col-left">' . $this->l('Initial stock:') . '</td>
									<td style="padding-bottom:5px;">
										<input size="3" maxlength="10" name="quantity" type="text" value="0" />
									</td>';
                }
                echo '<tr>
								<td class="col-left">' . $this->l('Minimum quantity:') . '</td>
									<td style="padding-bottom:5px;">
										<input size="3" maxlength="10" name="minimal_quantity" id="minimal_quantity" type="text" value="' . ($this->getFieldValue($obj, 'minimal_quantity') ? $this->getFieldValue($obj, 'minimal_quantity') : 1) . '" />
										<p>' . $this->l('The minimum quantity to buy this product (set to 1 to disable this feature)') . '</p>
									</td>
								</tr>';
            }
            if ($obj->id) {
                echo '
							<tr><td class="col-left">' . $this->l('Quantity in stock:') . '</td>
								<td style="padding-bottom:5px;"><b>' . $qty . '</b><input type="hidden" name="quantity" value="' . $qty . '" /></td>
							</tr>
						';
            }
            if ($has_attribute) {
                echo '<tr>
								<td class="col-left">&nbsp;</td>
								<td>
									<div class="hint clear" style="display: block;width: 70%;">' . $this->l('You used combinations, for this reason you cannot edit your stock quantity here, but in the Combinations tab') . '</div>
								</td>
							</tr>';
            }
        } else {
            echo '<tr>
							<td colspan="2">' . $this->l('The stock management is disabled') . '</td>
						</tr>';
            echo '
						<tr>
							<td class="col-left">' . $this->l('Minimum quantity:') . '</td>
							<td style="padding-bottom:5px;">
								<input size="3" maxlength="10" name="minimal_quantity" id="minimal_quantity" type="text" value="' . ($this->getFieldValue($obj, 'minimal_quantity') ? $this->getFieldValue($obj, 'minimal_quantity') : 1) . '" />
								<p>' . $this->l('The minimum quantity to buy this product (set to 1 to disable this feature)') . '</p>
							</td>
						</tr>
					';
        }
        echo '
					<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
					<tr>
						<td class="col-left">' . $this->l('Additional shipping cost:') . '</td>
						<td style="padding-bottom:5px;">
							<input type="text" name="additional_shipping_cost" value="' . Tools::safeOutput($this->getFieldValue($obj, 'additional_shipping_cost')) . '" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '');
        if ($default_country->display_tax_label) {
            echo ' (' . $this->l('tax excl.') . ')';
        }
        echo '<p>' . $this->l('Carrier tax will be applied.') . '</p>
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Displayed text when in-stock:') . '</td>
						<td style="padding-bottom:5px;" class="translatable">';
        foreach ($this->_languages as $language) {
            echo '		<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
								<input size="30" type="text" id="available_now_' . $language['id_lang'] . '" name="available_now_' . $language['id_lang'] . '"
								value="' . stripslashes(htmlentities($this->getFieldValue($obj, 'available_now', $language['id_lang']), ENT_COMPAT, 'UTF-8')) . '" />
								<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
							</div>';
        }
        echo '			</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Displayed text when allowed to be back-ordered:') . '</td>
						<td style="padding-bottom:5px;" class="translatable">';
        foreach ($this->_languages as $language) {
            echo '		<div  class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
								<input size="30" type="text" id="available_later_' . $language['id_lang'] . '" name="available_later_' . $language['id_lang'] . '"
								value="' . stripslashes(htmlentities($this->getFieldValue($obj, 'available_later', $language['id_lang']), ENT_COMPAT, 'UTF-8')) . '" />
								<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
							</div>';
        }
        echo '	</td>
					</tr>

					<script type="text/javascript">
						calcPriceTI();
					</script>

					<tr>
						<td class="col-left">' . $this->l('When out of stock:') . '</td>
						<td style="padding-bottom:5px;">
							<input type="radio" name="out_of_stock" id="out_of_stock_1" value="0" ' . ((int) $this->getFieldValue($obj, 'out_of_stock') == 0 ? 'checked="checked"' : '') . '/> <label for="out_of_stock_1" class="t" id="label_out_of_stock_1">' . $this->l('Deny orders') . '</label>
							<br /><input type="radio" name="out_of_stock" id="out_of_stock_2" value="1" ' . ($this->getFieldValue($obj, 'out_of_stock') == 1 ? 'checked="checked"' : '') . '/> <label for="out_of_stock_2" class="t" id="label_out_of_stock_2">' . $this->l('Allow orders') . '</label>
							<br /><input type="radio" name="out_of_stock" id="out_of_stock_3" value="2" ' . ($this->getFieldValue($obj, 'out_of_stock') == 2 ? 'checked="checked"' : '') . '/> <label for="out_of_stock_3" class="t" id="label_out_of_stock_3">' . $this->l('Default:') . ' <i>' . $this->l((int) Configuration::get('PS_ORDER_OUT_OF_STOCK') ? 'Allow orders' : 'Deny orders') . '</i> (' . $this->l('as set in') . ' <a href="index.php?tab=AdminPPreferences&token=' . Tools::getAdminToken('AdminPPreferences' . (int) Tab::getIdFromClassName('AdminPPreferences') . (int) $cookie->id_employee) . '"  onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');">' . $this->l('Preferences') . '</a>)</label>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="padding-bottom:5px;">
							<hr style="width:100%;" />
						</td>
					</tr>
					<tr>
						<td class="col-left"><label for="id_category_default" class="t">' . $this->l('Default category:') . '</label></td>
						<td>
						<div id="no_default_category" style="color: red;font-weight: bold;display: none;">' . $this->l('Please check a category in order to select the default category.') . '</div>
						<script type="text/javascript">
							var post_selected_cat;
						</script>';
        $default_category = Tools::getValue('id_category', 1);
        if (!$obj->id) {
            $selectedCat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->_defaultFormLanguage);
            echo '
							<script type="text/javascript">
								post_selected_cat = \'' . implode(',', array_keys($selectedCat)) . '\';
							</script>';
        } else {
            if (Tools::isSubmit('categoryBox')) {
                $selectedCat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->_defaultFormLanguage);
            } else {
                $selectedCat = Product::getProductCategoriesFull($obj->id, $this->_defaultFormLanguage);
            }
        }
        echo '<select id="id_category_default" name="id_category_default">';
        foreach ($selectedCat as $cat) {
            echo '<option value="' . $cat['id_category'] . '" ' . ($obj->id_category_default == $cat['id_category'] ? 'selected' : '') . '>' . $cat['name'] . '</option>';
        }
        echo '</select>
						</td>
					</tr>
					<tr id="tr_categories">
						<td colspan="2">
						';
        // Translations are not automatic for the moment ;)
        $trads = array('Home' => $this->l('Home'), 'selected' => $this->l('selected'), 'Collapse All' => $this->l('Collapse All'), 'Expand All' => $this->l('Expand All'), 'Check All' => $this->l('Check All'), 'Uncheck All' => $this->l('Uncheck All'));
        echo Helper::renderAdminCategorieTree($trads, $selectedCat) . '
						</td>
					</tr>
					<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
					<tr><td colspan="2">
						<span onclick="$(\'#seo\').slideToggle();" style="cursor: pointer"><img src="../img/admin/arrow.gif" alt="' . $this->l('SEO') . '" title="' . $this->l('SEO') . '" style="float:left; margin-right:5px;"/>' . $this->l('Click here to improve product\'s rank in search engines (SEO)') . '</span><br />
						<div id="seo" style="display: none; padding-top: 15px;">
							<table>
								<tr>
									<td class="col-left">' . $this->l('Meta title:') . '</td>
									<td class="translatable">';
        foreach ($this->_languages as $language) {
            echo '					<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
											<input size="55" type="text" id="meta_title_' . $language['id_lang'] . '" name="meta_title_' . $language['id_lang'] . '"
											value="' . htmlentities($this->getFieldValue($obj, 'meta_title', $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
											<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
										</div>';
        }
        echo '						<p class="clear">' . $this->l('Product page title; leave blank to use product name') . '</p>
									</td>
								</tr>
								<tr>
									<td class="col-left">' . $this->l('Meta description:') . '</td>
									<td class="translatable">';
        foreach ($this->_languages as $language) {
            echo '					<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
											<input size="55" type="text" id="meta_description_' . $language['id_lang'] . '" name="meta_description_' . $language['id_lang'] . '"
											value="' . htmlentities($this->getFieldValue($obj, 'meta_description', $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
											<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
										</div>';
        }
        echo '						<p class="clear">' . $this->l('A single sentence for HTML header') . '</p>
									</td>
								</tr>
								<tr>
									<td class="col-left">' . $this->l('Meta keywords:') . '</td>
									<td class="translatable">';
        foreach ($this->_languages as $language) {
            echo '					<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
											<input size="55" type="text" id="meta_keywords_' . $language['id_lang'] . '" name="meta_keywords_' . $language['id_lang'] . '"
											value="' . htmlentities($this->getFieldValue($obj, 'meta_keywords', $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
											<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
										</div>';
        }
        echo '						<p class="clear">' . $this->l('Keywords for HTML header, separated by a comma') . '</p>
									</td>
								</tr>
								<tr>
									<td class="col-left">' . $this->l('Friendly URL:') . '</td>
									<td class="translatable">';
        foreach ($this->_languages as $language) {
            echo '					<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
											<input size="55" type="text" id="link_rewrite_' . $language['id_lang'] . '" name="link_rewrite_' . $language['id_lang'] . '"
											value="' . htmlentities($this->getFieldValue($obj, 'link_rewrite', $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();" onchange="updateFriendlyURL();" /><sup> *</sup>
											<span class="hint" name="help_box">' . $this->l('Only letters and the "less" character are allowed') . '<span class="hint-pointer">&nbsp;</span></span>
										</div>';
        }
        echo '						<p class="clear" style="padding:10px 0 0 0">' . '<a style="cursor:pointer" class="button" onmousedown="updateFriendlyURLByName();">' . $this->l('Generate') . '</a>&nbsp;' . $this->l('Friendly-url from product\'s name.') . '<br /><br />';
        echo '						' . $this->l('Product link will look like this:') . ' ' . (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . '/<b>id_product</b>-<span id="friendly-url"></span>.html</p>
									</td>
								</tr>';
        echo '</td></tr></table>
						</div>
					</td></tr>
					<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
					<tr>
						<td class="col-left">' . $this->l('Short description:') . '<br /><br /><i>(' . $this->l('appears in the product lists and on the top of the product page') . ')</i></td>
						<td style="padding-bottom:5px;" class="translatable">';
        foreach ($this->_languages as $language) {
            echo '		<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . ';float: left;">
								<textarea class="rte" cols="100" rows="10" id="description_short_' . $language['id_lang'] . '" name="description_short_' . $language['id_lang'] . '">' . htmlentities(stripslashes($this->getFieldValue($obj, 'description_short', $language['id_lang'])), ENT_COMPAT, 'UTF-8') . '</textarea>
							</div>';
        }
        echo '		</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Description:') . '<br /><br /><i>(' . $this->l('appears in the body of the product page') . ')</i></td>
						<td style="padding-bottom:5px;" class="translatable">';
        foreach ($this->_languages as $language) {
            echo '		<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . ';float: left;">
								<textarea class="rte" cols="100" rows="20" id="description_' . $language['id_lang'] . '" name="description_' . $language['id_lang'] . '">' . htmlentities(stripslashes($this->getFieldValue($obj, 'description', $language['id_lang'])), ENT_COMPAT, 'UTF-8') . '</textarea>
							</div>';
        }
        echo '		</td>
					</tr>';
        echo '
					<tr>
						<td class="col-left">' . $this->l('Tags:') . '</td>
						<td style="padding-bottom:5px;" class="translatable">';
        if ($obj->id) {
            $obj->tags = Tag::getProductTags((int) $obj->id);
        }
        foreach ($this->_languages as $language) {
            echo '<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
							<input size="55" type="text" id="tags_' . $language['id_lang'] . '" name="tags_' . $language['id_lang'] . '"
							value="' . htmlentities(Tools::getValue('tags_' . $language['id_lang'], $obj->getTags($language['id_lang'], true)), ENT_COMPAT, 'UTF-8') . '" />
							<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' !<>;?=+#"&deg;{}_$%<span class="hint-pointer">&nbsp;</span></span>
						  </div>';
        }
        echo '	<p class="clear">' . $this->l('Tags separated by commas (e.g., dvd, dvd player, hifi)') . '</p>
						</td>
					</tr>';
        $accessories = Product::getAccessoriesLight((int) $cookie->id_lang, $obj->id);
        if ($postAccessories = Tools::getValue('inputAccessories')) {
            $postAccessoriesTab = explode('-', Tools::getValue('inputAccessories'));
            foreach ($postAccessoriesTab as $accessoryId) {
                if (!$this->haveThisAccessory($accessoryId, $accessories) and $accessory = Product::getAccessoryById($accessoryId)) {
                    $accessories[] = $accessory;
                }
            }
        }
        echo '
					<tr>
						<td class="col-left">' . $this->l('Accessories:') . '<br /><br /><i>' . $this->l('(Do not forget to Save the product afterward)') . '</i></td>
						<td style="padding-bottom:5px;">
							<div id="divAccessories">';
        foreach ($accessories as $accessory) {
            echo htmlentities($accessory['name'], ENT_COMPAT, 'UTF-8') . (!empty($accessory['reference']) ? ' (' . $accessory['reference'] . ')' : '') . ' <span onclick="delAccessory(' . $accessory['id_product'] . ');" style="cursor: pointer;"><img src="../img/admin/delete.gif" class="middle" alt="" /></span><br />';
        }
        echo '</div>
							<input type="hidden" name="inputAccessories" id="inputAccessories" value="';
        foreach ($accessories as $accessory) {
            echo (int) $accessory['id_product'] . '-';
        }
        echo '" />
							<input type="hidden" name="nameAccessories" id="nameAccessories" value="';
        foreach ($accessories as $accessory) {
            echo htmlentities($accessory['name'], ENT_COMPAT, 'UTF-8') . '¤';
        }
        echo '" />
							<script type="text/javascript">
								var formProduct;
								var accessories = new Array();
							</script>

							<link rel="stylesheet" type="text/css" href="' . __PS_BASE_URI__ . 'css/jquery.autocomplete.css" />
							<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/jquery/jquery.autocomplete.js"></script>
							<div id="ajax_choose_product" style="padding:6px; padding-top:2px; width:600px;">
								<p class="clear">' . $this->l('Begin typing the first letters of the product name, then select the product from the drop-down list:') . '</p>
								<input type="text" value="" id="product_autocomplete_input" />
								<img onclick="$(this).prev().search();" style="cursor: pointer;" src="../img/admin/add.gif" alt="' . $this->l('Add an accessory') . '" title="' . $this->l('Add an accessory') . '" />
							</div>
							<script type="text/javascript">
								urlToCall = null;
								/* function autocomplete */
								$(function() {
									$(\'#product_autocomplete_input\')
										.autocomplete(\'ajax_products_list.php\', {
											minChars: 1,
											autoFill: true,
											max:20,
											matchContains: true,
											mustMatch:true,
											scroll:false,
											cacheLength:0,
											formatItem: function(item) {
												return item[1]+\' - \'+item[0];
											}
										}).result(addAccessory);
									$(\'#product_autocomplete_input\').setOptions({
										extraParams: {excludeIds : getAccessorieIds()}
									});
								});
							</script>
						</td>
					</tr>
					<tr><td colspan="2" style="padding-bottom:10px;"><hr style="width:100%;" /></td></tr>
					<tr>
						<td colspan="2" style="text-align:center;">
							<input type="submit" value="' . $this->l('Save') . '" name="submitAdd' . $this->table . '" class="button" />
							&nbsp;<input type="submit" value="' . $this->l('Save and stay') . '" name="submitAdd' . $this->table . 'AndStay" class="button" /></td>
					</tr>
				</table>
			<br />
			</div>';
        // TinyMCE
        global $cookie;
        $iso = Language::getIsoById((int) $cookie->id_lang);
        $isoTinyMCE = file_exists(_PS_ROOT_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en';
        $ad = dirname($_SERVER["PHP_SELF"]);
        echo '
			<script type="text/javascript">
			var iso = \'' . $isoTinyMCE . '\' ;
			var pathCSS = \'' . _THEME_CSS_DIR_ . '\' ;
			var ad = \'' . $ad . '\' ;
			</script>
			<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/tiny_mce/tiny_mce.js"></script>
			<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/tinymce.inc.js"></script>
			<script type="text/javascript">
					toggleVirtualProduct(getE(\'is_virtual_good\'));
					unitPriceWithTax(\'unit\');
			</script>';
        $categoryBox = Tools::getValue('categoryBox', array());
    }
 protected function generateTaxRuleGroupData()
 {
     $delimiter = ';';
     $line = array();
     $titles = array();
     $new_path = new Sampledatainstall();
     $f = fopen($new_path->sendPath() . 'output/tax_rule_groups.vsc', 'w');
     foreach ($this->tax_rule_group_fields as $field => $array) {
         $titles[] = $array['label'];
     }
     fputcsv($f, $titles, $delimiter, '"');
     $tax_rule_groups = TaxRulesGroup::getTaxRulesGroups();
     if ($tax_rule_groups) {
         foreach ($tax_rule_groups as $tax_rule_group) {
             $trg = new TaxRulesGroup($tax_rule_group['id_tax_rules_group']);
             foreach ($this->tax_rule_group_fields as $field => $array) {
                 $line[$field] = property_exists('TaxRulesGroup', $field) && !is_array($trg->{$field}) && !Tools::isEmpty($trg->{$field}) ? $trg->{$field} : '';
             }
             if (!$line[$field]) {
                 $line[$field] = '';
             }
             fputcsv($f, $line, $delimiter, '"');
         }
     }
     fclose($f);
 }
 public function initContentForCombinations()
 {
     ${${"GLOBALS"}["vmqqtmkyw"]} = $this->object;
     if (!Combination::isFeatureActive()) {
         $this->displayWarning($this->getMessage("This feature has been disabled, you can activate this feature at this page:") . $this->getMessage("link to Performances"));
         return;
     }
     ${"GLOBALS"}["weevwwkl"] = "product";
     if (Validate::isLoadedObject(${${"GLOBALS"}["weevwwkl"]})) {
         self::$smarty->assign("country_display_tax_label", $this->context->country->display_tax_label);
         $zsahvowoo = "lang";
         self::$smarty->assign("tax_exclude_taxe_option", Tax::excludeTaxeOption());
         self::$smarty->assign("id_tax_rules_group", $product->id_tax_rules_group);
         self::$smarty->assign("tax_rules_groups", TaxRulesGroup::getTaxRulesGroups(true));
         ${$zsahvowoo} = new Language($this->id_language);
         self::$smarty->assign("iso_code", $lang->iso_code);
         self::$smarty->assign("combinationImagesJs", $this->getCombinationImagesJs());
         if ($product->is_virtual) {
             $tpkpvyor = "product";
             self::$smarty->assign("product", ${$tpkpvyor});
             $this->displayWarning($this->getMessage("A virtual product cannot have combinations."));
         } else {
             ${"GLOBALS"}["qqjbnscylsi"] = "attribute_js";
             ${"GLOBALS"}["nqxaoftbn"] = "attribute";
             $bcesaxqdqqq = "images";
             ${"GLOBALS"}["zcxmuajd"] = "ps_stock_mvt_reason_default";
             $vmytjghdfi = "attribute_js";
             $nrkrfhirkx = "attributes";
             ${${"GLOBALS"}["qqjbnscylsi"]} = array();
             $cappytc = "k";
             ${"GLOBALS"}["jyaoxpe"] = "attribute";
             ${$nrkrfhirkx} = Attribute::getAttributes($this->context->language->id, true);
             foreach (${${"GLOBALS"}["ecblflvypvt"]} as ${$cappytc} => ${${"GLOBALS"}["jyaoxpe"]}) {
                 ${$vmytjghdfi}[${${"GLOBALS"}["iixdipeiyldv"]}["id_attribute_group"]][${${"GLOBALS"}["iixdipeiyldv"]}["id_attribute"]] = ${${"GLOBALS"}["nqxaoftbn"]}["name"];
             }
             ${"GLOBALS"}["higiwiyuxd"] = "k";
             ${${"GLOBALS"}["sxexnhlq"]} = new Currency((int) Configuration::get("PS_CURRENCY_DEFAULT"));
             self::$smarty->assign("attributeJs", ${${"GLOBALS"}["xenfvrjowsy"]});
             self::$smarty->assign("attributes_groups", AttributeGroup::getAttributesGroups($this->context->language->id));
             self::$smarty->assign("currency", ${${"GLOBALS"}["sxexnhlq"]});
             ${"GLOBALS"}["xzqtsdnlkv"] = "images";
             ${$bcesaxqdqqq} = Image::getImages($this->context->language->id, $product->id);
             self::$smarty->assign("tax_exclude_option", Tax::excludeTaxeOption());
             $rbxbrbxg = "product";
             self::$smarty->assign("ps_weight_unit", Configuration::get("PS_WEIGHT_UNIT"));
             self::$smarty->assign("ps_use_ecotax", Configuration::get("PS_USE_ECOTAX"));
             self::$smarty->assign("field_value_unity", $this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "unity"));
             ${"GLOBALS"}["vpcuib"] = "image_type";
             self::$smarty->assign("reasons", ${${"GLOBALS"}["nqegxbae"]} = StockMvtReason::getStockMvtReasons($this->context->language->id));
             self::$smarty->assign("ps_stock_mvt_reason_default", ${${"GLOBALS"}["zcxmuajd"]} = Configuration::get("PS_STOCK_MVT_REASON_DEFAULT"));
             self::$smarty->assign("minimal_quantity", $this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "minimal_quantity") ? $this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "minimal_quantity") : 1);
             self::$smarty->assign("available_date", $this->getFieldValue(${$rbxbrbxg}, "available_date") != 0 ? stripslashes(htmlentities(Tools::displayDate($this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "available_date"), version_compare(_PS_VERSION_, "1.5.5", ">=") ? null : $this->context->language->id))) : "0000-00-00");
             ${${"GLOBALS"}["tqkkuicfgax"]} = 0;
             ${"GLOBALS"}["ucamhp"] = "product";
             self::$smarty->assign("imageType", ImageType::getByNameNType("small_default", "products"));
             self::$smarty->assign("imageWidth", (isset(${${"GLOBALS"}["rvkjjxqs"]}["width"]) ? (int) ${${"GLOBALS"}["vpcuib"]}["width"] : 64) + 25);
             foreach (${${"GLOBALS"}["xzqtsdnlkv"]} as ${${"GLOBALS"}["higiwiyuxd"]} => ${${"GLOBALS"}["inpuwydsyk"]}) {
                 $cshrlmyryz = "image";
                 ${${"GLOBALS"}["dhvuermstcbs"]}[${${"GLOBALS"}["qtxqhylrbsm"]}]["obj"] = new Image(${$cshrlmyryz}["id_image"]);
                 $kcvbkys = "i";
                 ++${$kcvbkys};
             }
             self::$smarty->assign("images", ${${"GLOBALS"}["dhvuermstcbs"]});
             self::$smarty->assign(array("combinationArray" => $this->getCombinations(${${"GLOBALS"}["ucamhp"]}, ${${"GLOBALS"}["sxexnhlq"]}), "product" => ${${"GLOBALS"}["vmqqtmkyw"]}, "id_category" => $product->getDefaultCategory(), "token_generator" => "tokengenerator", "combination_exists" => Shop::isFeatureActive() && Shop::getContextShopGroup()->share_stock && count(AttributeGroup::getAttributesGroups($this->context->language->id)) > 0));
         }
     } else {
         self::$smarty->assign("product", ${${"GLOBALS"}["vmqqtmkyw"]});
         $this->displayWarning($this->getMessage("You must save this product before adding combinations."));
     }
 }
Пример #12
0
 /**
  * @param $module
  * @return mixed
  */
 protected static function getTaxRules($module)
 {
     $taxRules = array();
     $taxRuleGroups = TaxRulesGroup::getTaxRulesGroups(true);
     foreach ($taxRuleGroups as $taxRuleGroup) {
         /** @var TaxCore $taxItem */
         $taxItem = ShopgateSettings::getTaxItemByTaxRuleGroupId($taxRuleGroup['id_tax_rules_group']);
         $rule = array('id' => $taxRuleGroup['id_tax_rules_group'], 'name' => $taxRuleGroup['name'], 'priority' => 0);
         $rule['product_tax_classes'] = array(array('id' => $taxItem->id, 'key' => is_array($taxItem->name) ? reset($taxItem->name) : ''));
         $rule['customer_tax_classes'] = array(array('key' => 'default', 'is_default' => true));
         $rule['tax_rates'] = array();
         if (version_compare(_PS_VERSION_, '1.5.0.1', '<')) {
             $taxRulesPrestashop = TaxRule::getTaxRulesByGroupId($taxRuleGroup['id_tax_rules_group']);
         } else {
             $taxRulesPrestashop = TaxRule::getTaxRulesByGroupId($module->context->language->id, $taxRuleGroup['id_tax_rules_group']);
         }
         foreach ($taxRulesPrestashop as $idCountry => $taxRuleItem) {
             if (version_compare(_PS_VERSION_, '1.5.0.1', '>=')) {
                 $taxRuleItem = new TaxRule($taxRuleItem['id_tax_rule']);
                 $idTax = $taxRuleItem->id_tax;
                 $idCountry = $taxRuleItem->id_country;
                 $idState = $taxRuleItem->id_state;
             } else {
                 $idTax = self::getTaxIdFromTaxRule($taxRuleItem);
                 $idState = key($taxRuleItem);
             }
             /** @var TaxCore $taxItem */
             $taxItem = new Tax($idTax, $module->context->language->id);
             $country = Country::getIsoById($idCountry);
             $stateModel = new State($idState);
             $state = $stateModel->iso_code;
             $resultTaxRate = array();
             $resultTaxRate['key'] = self::getTaxRateKey($taxItem, $country, $state);
             //Fix for 1.4.x.x the taxes were exported multiple
             if (self::arrayValueExists('key', $resultTaxRate['key'], $rule['tax_rates'])) {
                 continue;
             }
             $rule['tax_rates'][] = $resultTaxRate;
         }
         if ($taxItem->active && Configuration::get('PS_TAX') == 1) {
             $taxRules[] = $rule;
         }
     }
     return $taxRules;
 }
 public function renderStepThree($carrier)
 {
     $this->fields_form = array('form' => array('id_form' => 'step_carrier_ranges', 'input' => array(array('type' => 'radio', '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'))), 'desc' => $this->l('Include the shipping and handling costs in the carrier price.')), array('type' => 'radio', 'label' => $this->l('Apply shipping cost:'), 'name' => 'is_free', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'is_free_off', 'value' => 0, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />'), array('id' => 'is_free_on', 'value' => 1, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />')), 'desc' => $this->l('Apply both regular shipping cost and product-specific shipping costs.')), array('type' => 'radio', 'label' => $this->l('Billing:'), 'name' => 'shipping_method', 'required' => false, 'class' => 't', 'br' => true, 'values' => array(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('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' => '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'), 'desc' => $this->l('Out-of-range behavior occurs when no defined range matches the customer\'s cart (e.g. when the weight of the cart is greater than the highest weight limit defined by the weight ranges)')), array('type' => 'zone', 'name' => 'zones'))));
     $tpl_vars = array();
     $tpl_vars['PS_WEIGHT_UNIT'] = Configuration::get('PS_WEIGHT_UNIT');
     $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
     $tpl_vars['currency_sign'] = $currency->sign;
     $fields_value = $this->getStepThreeFieldsValues($carrier);
     $this->getTplRangesVarsAndValues($carrier, $tpl_vars, $fields_value);
     return $this->renderGenericForm(array('form' => $this->fields_form), $fields_value, $tpl_vars);
 }
Пример #14
0
 private function _displayForm($updated, $debug_mode = false, &$debug_info = array())
 {
     $forsikring = Configuration::get('FRAKTGUIDE_FORSIKRING');
     $edi = Configuration::get('FRAKTGUIDE_EDI');
     $frapostnr = Configuration::get('FRAKTGUIDE_FRA_POSTNUMMER');
     $products_str = Configuration::get('FRAKTGUIDE_PRODUCTS');
     $selected_products = $products_str ? explode(';', $products_str) : array();
     $max_price = Configuration::get('FRAKTGUIDE_A_POST_MAX_PRIS');
     $id_tax_rules_group = Configuration::get('FRAKTGUIDE_ID_TAX_RULES_GROUP');
     $products = array();
     $product_descriptions = array();
     $error = null;
     if ($debug_mode) {
         array_push($debug_info, "Starting display of configuration");
     }
     if ($frapostnr) {
         $url = 'http://fraktguide.bring.no/fraktguide/products/all.json?from=' . $frapostnr . '&to=0185&weightInGrams=1000&edi=' . ($edi ? 'true' : 'false');
         if ($debug_mode) {
             array_push($debug_info, "Requesting url: " . $url);
         }
         $json_products = $this->getJson($url, $debug_mode, $debug_info);
         if ($debug_mode) {
             array_push($debug_info, "JSON response: " . print_r($json_products, true));
         }
         if ($json_products) {
             foreach ($json_products["Product"] as $json_product) {
                 $id = $json_product["ProductId"];
                 $name = $json_product["GuiInformation"]["ProductName"];
                 $desc = $json_product["GuiInformation"]["HelpText"];
                 $products[$id] = $name;
                 $product_descriptions[$id] = $desc;
             }
             if ($debug_mode) {
                 array_push($debug_info, "Products: " . print_r($products, true));
                 array_push($debug_info, "Product descriptions: " . print_r($product_descriptions, true));
             }
         } else {
             $error = $this->l("Feil ved uthenting av produkter");
         }
     }
     $tax_rules_groups = array();
     foreach (TaxRulesGroup::getTaxRulesGroups(true) as $tax_rule) {
         $tax_rules_groups[$tax_rule['id_tax_rules_group']] = $tax_rule['name'];
     }
     $this->context->smarty->assign(array('error' => $error, 'updated' => $updated, 'fraktguide_edi' => $edi, 'fraktguide_a_post_max_price' => $max_price, 'fraktguide_insurance' => $forsikring, 'fraktguide_postal_code' => $frapostnr, 'fraktguide_products' => $products, 'fraktguide_product_descriptions' => $product_descriptions, 'fraktguide_selected_products' => $selected_products, 'fraktguide_debug_mode' => $debug_mode, 'fraktguide_debug_info' => $debug_info, 'fraktguide_id_tax_rules_group' => $id_tax_rules_group, 'fraktguide_tax_groups' => $tax_rules_groups));
     $this->_html = $this->display(__FILE__, "templates/config.tpl");
 }