Esempio n. 1
0
 public static function getPath($file = '')
 {
     $controller = Context::getContext()->controller;
     if (!Module::isInstalled('agilemultipleseller')) {
         return parent::getPath($file);
     }
     if (!$controller->is_seller) {
         return parent::getPath($file);
     }
     $dir = (defined('_PS_HOST_MODE_') ? _PS_ROOT_DIR_ : _PS_ADMIN_DIR_) . DIRECTORY_SEPARATOR . 'import' . DIRECTORY_SEPARATOR . $controller->context->cookie->id_employee;
     if (!file_exists($dir)) {
         mkdir($dir);
     }
     return $dir . DIRECTORY_SEPARATOR . $file;
 }
Esempio n. 2
0
 public function __construct()
 {
     $this->bootstrap = true;
     parent::__construct();
     $this->entities = array($this->l('Categories'), $this->l('Products'), $this->l('Combinations'), $this->l('Customers'), $this->l('Addresses'), $this->l('Brands'), $this->l('Suppliers'), $this->l('Alias'), $this->l('Store contacts'));
     // @since 1.5.0
     if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
         $this->entities = array_merge($this->entities, array($this->l('Supply Orders'), $this->l('Supply Order Details')));
     }
     $this->entities = array_flip($this->entities);
     switch ((int) Tools::getValue('entity')) {
         case $this->entities[$this->l('Combinations')]:
             $this->required_fields = array('group', 'attribute');
             $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id_product' => array('label' => $this->l('Product ID')), 'product_reference' => array('label' => $this->l('Product Reference')), 'group' => array('label' => $this->l('Attribute (Name:Type:Position)') . '*'), 'attribute' => array('label' => $this->l('Value (Value:Position)') . '*'), 'supplier_reference' => array('label' => $this->l('Supplier reference')), 'reference' => array('label' => $this->trans('Reference', array(), 'Admin.Global')), 'ean13' => array('label' => $this->l('EAN13')), 'upc' => array('label' => $this->l('UPC')), 'wholesale_price' => array('label' => $this->l('Wholesale price')), 'price' => array('label' => $this->l('Impact on price')), 'ecotax' => array('label' => $this->l('Ecotax')), 'quantity' => array('label' => $this->l('Quantity')), 'minimal_quantity' => array('label' => $this->l('Minimal quantity')), 'weight' => array('label' => $this->l('Impact on weight')), 'default_on' => array('label' => $this->l('Default (0 = No, 1 = Yes)')), 'available_date' => array('label' => $this->l('Combination availability date')), 'image_position' => array('label' => $this->l('Choose among product images by position (1,2,3...)')), 'image_url' => array('label' => $this->l('Image URLs (x,y,z...)')), 'image_alt' => array('label' => $this->l('Image alt texts (x,y,z...)')), 'shop' => array('label' => $this->l('ID / Name of shop'), 'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.')), 'advanced_stock_management' => array('label' => $this->l('Advanced Stock Management'), 'help' => $this->l('Enable Advanced Stock Management on product (0 = No, 1 = Yes)')), 'depends_on_stock' => array('label' => $this->l('Depends on stock'), 'help' => $this->l('0 = Use quantity set in product, 1 = Use quantity from warehouse.')), 'warehouse' => array('label' => $this->l('Warehouse'), 'help' => $this->l('ID of the warehouse to set as storage.')));
             self::$default_values = array('reference' => '', 'supplier_reference' => '', 'ean13' => '', 'upc' => '', 'wholesale_price' => 0, 'price' => 0, 'ecotax' => 0, 'quantity' => 0, 'minimal_quantity' => 1, 'weight' => 0, 'default_on' => 0, 'advanced_stock_management' => 0, 'depends_on_stock' => 0, 'available_date' => date('Y-m-d'));
             break;
         case $this->entities[$this->l('Categories')]:
             $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->trans('ID', array(), 'Admin.Global')), 'active' => array('label' => $this->l('Active (0/1)')), 'name' => array('label' => $this->trans('Name', array(), 'Admin.Global')), 'parent' => array('label' => $this->l('Parent category')), 'is_root_category' => array('label' => $this->l('Root category (0/1)'), 'help' => $this->l('A category root is where a category tree can begin. This is used with multistore.')), 'description' => array('label' => $this->trans('Description', array(), 'Admin.Global')), 'meta_title' => array('label' => $this->l('Meta title')), 'meta_keywords' => array('label' => $this->l('Meta keywords')), 'meta_description' => array('label' => $this->l('Meta description')), 'link_rewrite' => array('label' => $this->l('URL rewritten')), 'image' => array('label' => $this->l('Image URL')), 'shop' => array('label' => $this->l('ID / Name of shop'), 'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.')));
             self::$default_values = array('active' => '1', 'parent' => Configuration::get('PS_HOME_CATEGORY'), 'link_rewrite' => '');
             break;
         case $this->entities[$this->l('Products')]:
             self::$validators['image'] = array('AdminImportController', 'split');
             $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->trans('ID', array(), 'Admin.Global')), 'active' => array('label' => $this->l('Active (0/1)')), 'name' => array('label' => $this->trans('Name', array(), 'Admin.Global')), 'category' => array('label' => $this->l('Categories (x,y,z...)')), 'price_tex' => array('label' => $this->l('Price tax excluded')), 'price_tin' => array('label' => $this->l('Price tax included')), 'id_tax_rules_group' => array('label' => $this->l('Tax rules ID')), 'wholesale_price' => array('label' => $this->l('Wholesale price')), 'on_sale' => array('label' => $this->l('On sale (0/1)')), 'reduction_price' => array('label' => $this->l('Discount amount')), 'reduction_percent' => array('label' => $this->l('Discount percent')), 'reduction_from' => array('label' => $this->l('Discount from (yyyy-mm-dd)')), 'reduction_to' => array('label' => $this->l('Discount to (yyyy-mm-dd)')), 'reference' => array('label' => $this->l('Reference #')), 'supplier_reference' => array('label' => $this->l('Supplier reference #')), 'supplier' => array('label' => $this->l('Supplier')), 'manufacturer' => array('label' => $this->l('Brand')), 'ean13' => array('label' => $this->l('EAN13')), 'upc' => array('label' => $this->l('UPC')), 'ecotax' => array('label' => $this->l('Ecotax')), 'width' => array('label' => $this->l('Width')), 'height' => array('label' => $this->l('Height')), 'depth' => array('label' => $this->l('Depth')), 'weight' => array('label' => $this->l('Weight')), 'quantity' => array('label' => $this->l('Quantity')), 'minimal_quantity' => array('label' => $this->l('Minimal quantity')), 'visibility' => array('label' => $this->l('Visibility')), 'additional_shipping_cost' => array('label' => $this->l('Additional shipping cost')), 'unity' => array('label' => $this->l('Unit for the unit price')), 'unit_price' => array('label' => $this->l('Unit price')), 'description_short' => array('label' => $this->l('Short description')), 'description' => array('label' => $this->trans('Description', array(), 'Admin.Global')), 'tags' => array('label' => $this->l('Tags (x,y,z...)')), 'meta_title' => array('label' => $this->l('Meta title')), 'meta_keywords' => array('label' => $this->l('Meta keywords')), 'meta_description' => array('label' => $this->l('Meta description')), 'link_rewrite' => array('label' => $this->l('URL rewritten')), 'available_now' => array('label' => $this->l('Text when in stock')), 'available_later' => array('label' => $this->l('Text when backorder allowed')), 'available_for_order' => array('label' => $this->l('Available for order (0 = No, 1 = Yes)')), 'available_date' => array('label' => $this->l('Product availability date')), 'date_add' => array('label' => $this->l('Product creation date')), 'show_price' => array('label' => $this->l('Show price (0 = No, 1 = Yes)')), 'image' => array('label' => $this->l('Image URLs (x,y,z...)')), 'image_alt' => array('label' => $this->l('Image alt texts (x,y,z...)')), 'delete_existing_images' => array('label' => $this->l('Delete existing images (0 = No, 1 = Yes)')), 'features' => array('label' => $this->l('Feature (Name:Value:Position:Customized)')), 'online_only' => array('label' => $this->l('Available online only (0 = No, 1 = Yes)')), 'condition' => array('label' => $this->l('Condition')), 'customizable' => array('label' => $this->l('Customizable (0 = No, 1 = Yes)')), 'uploadable_files' => array('label' => $this->l('Uploadable files (0 = No, 1 = Yes)')), 'text_fields' => array('label' => $this->l('Text fields (0 = No, 1 = Yes)')), 'out_of_stock' => array('label' => $this->l('Action when out of stock')), 'is_virtual' => array('label' => $this->l('Virtual product (0 = No, 1 = Yes)')), 'file_url' => array('label' => $this->l('File URL')), 'nb_downloadable' => array('label' => $this->l('Number of allowed downloads'), 'help' => $this->l('Number of downloads allowed per customer. Set to 0 for unlimited downloads.')), 'date_expiration' => array('label' => $this->l('Expiration date (yyyy-mm-dd)')), 'nb_days_accessible' => array('label' => $this->l('Number of days'), 'help' => $this->l('Number of days this file can be accessed by customers. Set to zero for unlimited access.')), 'shop' => array('label' => $this->l('ID / Name of shop'), 'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.')), 'advanced_stock_management' => array('label' => $this->l('Advanced Stock Management'), 'help' => $this->l('Enable Advanced Stock Management on product (0 = No, 1 = Yes).')), 'depends_on_stock' => array('label' => $this->l('Depends on stock'), 'help' => $this->l('0 = Use quantity set in product, 1 = Use quantity from warehouse.')), 'warehouse' => array('label' => $this->l('Warehouse'), 'help' => $this->l('ID of the warehouse to set as storage.')), 'accessories' => array('label' => $this->l('Accessories (x,y,z...)')));
             self::$default_values = array('id_category' => array((int) Configuration::get('PS_HOME_CATEGORY')), 'id_category_default' => null, 'active' => '1', 'width' => 0.0, 'height' => 0.0, 'depth' => 0.0, 'weight' => 0.0, 'visibility' => 'both', 'additional_shipping_cost' => 0.0, 'unit_price' => 0, 'quantity' => 0, 'minimal_quantity' => 1, 'price' => 0, 'id_tax_rules_group' => 0, 'description_short' => array((int) Configuration::get('PS_LANG_DEFAULT') => ''), 'link_rewrite' => array((int) Configuration::get('PS_LANG_DEFAULT') => ''), 'online_only' => 0, 'condition' => 'new', 'available_date' => date('Y-m-d'), 'date_add' => date('Y-m-d H:i:s'), 'date_upd' => date('Y-m-d H:i:s'), 'customizable' => 0, 'uploadable_files' => 0, 'text_fields' => 0, 'advanced_stock_management' => 0, 'depends_on_stock' => 0, 'is_virtual' => 0);
             break;
         case $this->entities[$this->l('Customers')]:
             //Overwrite required_fields AS only email is required whereas other entities
             $this->required_fields = array('email', 'passwd', 'lastname', 'firstname');
             $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->trans('ID', array(), 'Admin.Global')), 'active' => array('label' => $this->l('Active  (0/1)')), 'id_gender' => array('label' => $this->l('Titles ID (Mr = 1, Ms = 2, else 0)')), 'email' => array('label' => $this->l('Email *')), 'passwd' => array('label' => $this->l('Password *')), 'birthday' => array('label' => $this->l('Birthday (yyyy-mm-dd)')), 'lastname' => array('label' => $this->l('Last Name *')), 'firstname' => array('label' => $this->l('First Name *')), 'newsletter' => array('label' => $this->l('Newsletter (0/1)')), 'optin' => array('label' => $this->l('Partner offers (0/1)')), 'date_add' => array('label' => $this->l('Registration date (yyyy-mm-dd)')), 'group' => array('label' => $this->l('Groups (x,y,z...)')), 'id_default_group' => array('label' => $this->l('Default group ID')), 'id_shop' => array('label' => $this->l('ID / Name of shop'), 'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.')));
             self::$default_values = array('active' => '1', 'id_shop' => Configuration::get('PS_SHOP_DEFAULT'));
             break;
         case $this->entities[$this->l('Addresses')]:
             //Overwrite required_fields
             $this->required_fields = array('alias', 'lastname', 'firstname', 'address1', 'postcode', 'country', 'customer_email', 'city');
             $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->trans('ID', array(), 'Admin.Global')), 'alias' => array('label' => $this->l('Alias *')), 'active' => array('label' => $this->l('Active  (0/1)')), 'customer_email' => array('label' => $this->l('Customer email *')), 'id_customer' => array('label' => $this->l('Customer ID')), 'manufacturer' => array('label' => $this->l('Brand')), 'supplier' => array('label' => $this->l('Supplier')), 'company' => array('label' => $this->trans('Company', array(), 'Admin.Global')), 'lastname' => array('label' => $this->l('Last Name *')), 'firstname' => array('label' => $this->l('First Name *')), 'address1' => array('label' => $this->l('Address 1 *')), 'address2' => array('label' => $this->l('Address 2')), 'postcode' => array('label' => $this->l('Zip/postal code *')), 'city' => array('label' => $this->l('City *')), 'country' => array('label' => $this->l('Country *')), 'state' => array('label' => $this->l('State')), 'other' => array('label' => $this->l('Other')), 'phone' => array('label' => $this->l('Phone')), 'phone_mobile' => array('label' => $this->l('Mobile Phone')), 'vat_number' => array('label' => $this->l('VAT number')), 'dni' => array('label' => $this->l('DNI/NIF/NIE')));
             self::$default_values = array('alias' => 'Alias', 'postcode' => 'X');
             break;
         case $this->entities[$this->l('Brands')]:
         case $this->entities[$this->l('Suppliers')]:
             //Overwrite validators AS name is not MultiLangField
             self::$validators = array('description' => array('AdminImportController', 'createMultiLangField'), 'short_description' => array('AdminImportController', 'createMultiLangField'), 'meta_title' => array('AdminImportController', 'createMultiLangField'), 'meta_keywords' => array('AdminImportController', 'createMultiLangField'), 'meta_description' => array('AdminImportController', 'createMultiLangField'));
             $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->trans('ID', array(), 'Admin.Global')), 'active' => array('label' => $this->l('Active (0/1)')), 'name' => array('label' => $this->trans('Name', array(), 'Admin.Global')), 'description' => array('label' => $this->trans('Description', array(), 'Admin.Global')), 'short_description' => array('label' => $this->l('Short description')), 'meta_title' => array('label' => $this->l('Meta title')), 'meta_keywords' => array('label' => $this->l('Meta keywords')), 'meta_description' => array('label' => $this->l('Meta description')), 'image' => array('label' => $this->l('Image URL')), 'shop' => array('label' => $this->l('ID / Name of group shop'), 'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.')));
             self::$default_values = array('shop' => Shop::getGroupFromShop(Configuration::get('PS_SHOP_DEFAULT')));
             break;
         case $this->entities[$this->l('Alias')]:
             //Overwrite required_fields
             $this->required_fields = array('alias', 'search');
             $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->trans('ID', array(), 'Admin.Global')), 'alias' => array('label' => $this->l('Alias *')), 'search' => array('label' => $this->l('Search *')), 'active' => array('label' => $this->l('Active')));
             self::$default_values = array('active' => '1');
             break;
         case $this->entities[$this->l('Store contacts')]:
             unset(self::$validators['name']);
             self::$validators = array('hours' => array('AdminImportController', 'split'));
             $this->required_fields = array('address1', 'city', 'country', 'latitude', 'longitude');
             $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->trans('ID', array(), 'Admin.Global')), 'active' => array('label' => $this->l('Active (0/1)')), 'name' => array('label' => $this->trans('Name', array(), 'Admin.Global')), 'address1' => array('label' => $this->l('Address') . '*'), 'address2' => array('label' => $this->l('Address (2)')), 'postcode' => array('label' => $this->l('Zip/postal Code')), 'state' => array('label' => $this->l('State')), 'city' => array('label' => $this->trans('City', array(), 'Admin.Global') . '*'), 'country' => array('label' => $this->trans('Country', array(), 'Admin.Global') . '*'), 'latitude' => array('label' => $this->l('Latitude') . '*'), 'longitude' => array('label' => $this->l('Longitude') . '*'), 'phone' => array('label' => $this->l('Phone')), 'fax' => array('label' => $this->l('Fax')), 'email' => array('label' => $this->l('E-mail address')), 'note' => array('label' => $this->l('Note')), 'hours' => array('label' => $this->l('Hours (x,y,z...)')), 'image' => array('label' => $this->l('Picture URL')), 'shop' => array('label' => $this->l('ID / Name of shop'), 'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.')));
             self::$default_values = array('active' => '1');
             break;
     }
     // @since 1.5.0
     if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
         switch ((int) Tools::getValue('entity')) {
             case $this->entities[$this->l('Supply Orders')]:
                 // required fields
                 $this->required_fields = array('id_supplier', 'id_warehouse', 'reference', 'date_delivery_expected');
                 // available fields
                 $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->trans('ID', array(), 'Admin.Global')), 'id_supplier' => array('label' => $this->l('Supplier ID *')), 'id_lang' => array('label' => $this->l('Lang ID')), 'id_warehouse' => array('label' => $this->l('Warehouse ID *')), 'id_currency' => array('label' => $this->l('Currency ID *')), 'reference' => array('label' => $this->l('Supply Order Reference *')), 'date_delivery_expected' => array('label' => $this->l('Delivery Date (Y-M-D)*')), 'discount_rate' => array('label' => $this->l('Discount Rate')), 'is_template' => array('label' => $this->l('Template')));
                 // default values
                 self::$default_values = array('id_lang' => (int) Configuration::get('PS_LANG_DEFAULT'), 'id_currency' => Currency::getDefaultCurrency()->id, 'discount_rate' => '0', 'is_template' => '0');
                 break;
             case $this->entities[$this->l('Supply Order Details')]:
                 // required fields
                 $this->required_fields = array('supply_order_reference', 'id_product', 'unit_price_te', 'quantity_expected');
                 // available fields
                 $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'supply_order_reference' => array('label' => $this->l('Supply Order Reference *')), 'id_product' => array('label' => $this->l('Product ID *')), 'id_product_attribute' => array('label' => $this->l('Product Attribute ID')), 'unit_price_te' => array('label' => $this->l('Unit Price (tax excl.)*')), 'quantity_expected' => array('label' => $this->l('Quantity Expected *')), 'discount_rate' => array('label' => $this->l('Discount Rate')), 'tax_rate' => array('label' => $this->l('Tax Rate')));
                 // default values
                 self::$default_values = array('discount_rate' => '0', 'tax_rate' => '0');
                 break;
         }
     }
     $this->separator = ($separator = Tools::substr(strval(trim(Tools::getValue('separator'))), 0, 1)) ? $separator : ';';
     $this->convert = false;
     $this->multiple_value_separator = ($separator = Tools::substr(strval(trim(Tools::getValue('multiple_value_separator'))), 0, 1)) ? $separator : ',';
 }
 public function __construct()
 {
     $this->entities = array($this->l('Categories'), $this->l('Products'), $this->l('Combinations'), $this->l('Customers'), $this->l('Addresses'), $this->l('Manufacturers'), $this->l('Suppliers'));
     // @since 1.5.0
     if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
         $this->entities = array_merge($this->entities, array($this->l('Supply Orders'), $this->l('Supply Order Details')));
     }
     $this->entities = array_flip($this->entities);
     switch ((int) Tools::getValue('entity')) {
         case $this->entities[$this->l('Combinations')]:
             $this->required_fields = array('id_product', 'group', 'attribute');
             $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id_product' => array('label' => $this->l('Product ID') . '*'), 'group' => array('label' => $this->l('Attribute (Name:Type:Position)') . '*'), 'attribute' => array('label' => $this->l('Value (Value:Position)') . '*'), 'supplier_reference' => array('label' => $this->l('Supplier reference')), 'reference' => array('label' => $this->l('Reference')), 'ean13' => array('label' => $this->l('EAN13')), 'upc' => array('label' => $this->l('UPC')), 'wholesale_price' => array('label' => $this->l('Wholesale price')), 'price' => array('label' => $this->l('Impact on price')), 'ecotax' => array('label' => $this->l('Ecotax')), 'quantity' => array('label' => $this->l('Quantity')), 'minimal_quantity' => array('label' => $this->l('Minimal quantity')), 'weight' => array('label' => $this->l('Impact on weight')), 'default_on' => array('label' => $this->l('Default (0 = No, 1 = Yes)')), 'image_position' => array('label' => $this->l('Image position')), 'image_url' => array('label' => $this->l('Image URL')), 'delete_existing_images' => array('label' => $this->l('Delete existing images (0 = No, 1 = Yes)')), 'shop' => array('label' => $this->l('ID / Name of shop'), 'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.')));
             self::$default_values = array('reference' => '', 'supplier_reference' => '', 'ean13' => '', 'upc' => '', 'wholesale_price' => 0, 'price' => 0, 'ecotax' => 0, 'quantity' => 0, 'minimal_quantity' => 1, 'weight' => 0, 'default_on' => 0);
             break;
         case $this->entities[$this->l('Categories')]:
             $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->l('ID')), 'active' => array('label' => $this->l('Active (0/1)')), 'name' => array('label' => $this->l('Name *')), 'parent' => array('label' => $this->l('Parent category')), 'is_root_category' => array('label' => $this->l('Root category (0/1)'), 'help' => $this->l('A category root is where a category tree can begin. This is used with multistore.')), 'description' => array('label' => $this->l('Description')), 'meta_title' => array('label' => $this->l('Meta title')), 'meta_keywords' => array('label' => $this->l('Meta keywords')), 'meta_description' => array('label' => $this->l('Meta description')), 'link_rewrite' => array('label' => $this->l('URL rewritten')), 'image' => array('label' => $this->l('Image URL')), 'shop' => array('label' => $this->l('ID / Name of shop'), 'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.')));
             self::$default_values = array('active' => '1', 'parent' => Configuration::get('PS_HOME_CATEGORY'), 'link_rewrite' => '');
             break;
         case $this->entities[$this->l('Products')]:
             self::$validators['image'] = array('AdminImportController', 'split');
             $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->l('ID')), 'active' => array('label' => $this->l('Active (0/1)')), 'name' => array('label' => $this->l('Name *')), 'category' => array('label' => $this->l('Categories (x,y,z...)')), 'price_tex' => array('label' => $this->l('Price tax excluded')), 'price_tin' => array('label' => $this->l('Price tax included')), 'id_tax_rules_group' => array('label' => $this->l('Tax rules ID')), 'wholesale_price' => array('label' => $this->l('Wholesale price')), 'on_sale' => array('label' => $this->l('On sale (0/1)')), 'reduction_price' => array('label' => $this->l('Discount amount')), 'reduction_percent' => array('label' => $this->l('Discount percent')), 'reduction_from' => array('label' => $this->l('Discount from (yyyy-mm-dd)')), 'reduction_to' => array('label' => $this->l('Discount to (yyyy-mm-dd)')), 'reference' => array('label' => $this->l('Reference #')), 'supplier_reference' => array('label' => $this->l('Supplier reference #')), 'supplier' => array('label' => $this->l('Supplier')), 'manufacturer' => array('label' => $this->l('Manufacturer')), 'ean13' => array('label' => $this->l('EAN13')), 'upc' => array('label' => $this->l('UPC')), 'ecotax' => array('label' => $this->l('Ecotax')), 'weight' => array('label' => $this->l('Weight')), 'quantity' => array('label' => $this->l('Quantity')), 'description_short' => array('label' => $this->l('Short description')), 'description' => array('label' => $this->l('Description')), 'tags' => array('label' => $this->l('Tags (x,y,z...)')), 'meta_title' => array('label' => $this->l('Meta title')), 'meta_keywords' => array('label' => $this->l('Meta keywords')), 'meta_description' => array('label' => $this->l('Meta description')), 'link_rewrite' => array('label' => $this->l('URL rewritten')), 'available_now' => array('label' => $this->l('Text when in stock')), 'available_later' => array('label' => $this->l('Text when backorder allowed')), 'available_for_order' => array('label' => $this->l('Available for order (0 = No, 1 = Yes)')), 'date_add' => array('label' => $this->l('Product creation date')), 'show_price' => array('label' => $this->l('Show price (0 = No, 1 = Yes)')), 'image' => array('label' => $this->l('Image URLs (x,y,z...)')), 'delete_existing_images' => array('label' => $this->l('Delete existing images (0 = No, 1 = Yes)')), 'features' => array('label' => $this->l('Feature(Name:Value:Position)')), 'online_only' => array('label' => $this->l('Available online only (0 = No, 1 = Yes)')), 'condition' => array('label' => $this->l('Condition')), 'shop' => array('label' => $this->l('ID / Name of shop'), 'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.')));
             self::$default_values = array('id_category' => array((int) Configuration::get('PS_HOME_CATEGORY')), 'id_category_default' => (int) Configuration::get('PS_HOME_CATEGORY'), 'active' => '1', 'quantity' => 0, 'price' => 0, 'id_tax_rules_group' => 0, 'description_short' => array((int) Configuration::get('PS_LANG_DEFAULT') => ''), 'link_rewrite' => array((int) Configuration::get('PS_LANG_DEFAULT') => ''), 'online_only' => 0, 'condition' => 'new', 'date_add' => date('Y-m-d H:i:s'), 'condition' => 'new');
             break;
         case $this->entities[$this->l('Customers')]:
             //Overwrite required_fields AS only email is required whereas other entities
             $this->required_fields = array('email', 'passwd', 'lastname', 'firstname');
             $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->l('ID')), 'active' => array('label' => $this->l('Active  (0/1)')), 'id_gender' => array('label' => $this->l('Titles ID (Mr = 1, Ms = 2, else 0)')), 'email' => array('label' => $this->l('Email *')), 'passwd' => array('label' => $this->l('Password *')), 'birthday' => array('label' => $this->l('Birthday (yyyy-mm-dd)')), 'lastname' => array('label' => $this->l('Last Name *')), 'firstname' => array('label' => $this->l('First Name *')), 'newsletter' => array('label' => $this->l('Newsletter (0/1)')), 'optin' => array('label' => $this->l('Opt-in (0/1)')), 'id_shop' => array('label' => $this->l('ID / Name of shop'), 'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.')));
             self::$default_values = array('active' => '1', 'id_shop' => Configuration::get('PS_SHOP_DEFAULT'));
             break;
         case $this->entities[$this->l('Addresses')]:
             //Overwrite required_fields
             $this->required_fields = array('lastname', 'firstname', 'address1', 'postcode', 'country', 'customer_email', 'city');
             $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->l('ID')), 'alias' => array('label' => $this->l('Alias *')), 'active' => array('label' => $this->l('Active  (0/1)')), 'customer_email' => array('label' => $this->l('Customer email')), 'id_customer' => array('label' => $this->l('Customer ID:')), 'manufacturer' => array('label' => $this->l('Manufacturer')), 'supplier' => array('label' => $this->l('Supplier')), 'company' => array('label' => $this->l('Company')), 'lastname' => array('label' => $this->l('Last Name *')), 'firstname' => array('label' => $this->l('First Name *')), 'address1' => array('label' => $this->l('Address 1 *')), 'address2' => array('label' => $this->l('Address 2')), 'postcode' => array('label' => $this->l('Postal code / Zipcode*')), 'city' => array('label' => $this->l('City *')), 'country' => array('label' => $this->l('Country *')), 'state' => array('label' => $this->l('State')), 'other' => array('label' => $this->l('Other')), 'phone' => array('label' => $this->l('Phone')), 'phone_mobile' => array('label' => $this->l('Mobile Phone')), 'vat_number' => array('label' => $this->l('VAT number')));
             self::$default_values = array('alias' => 'Alias', 'postcode' => 'X');
             break;
         case $this->entities[$this->l('Manufacturers')]:
         case $this->entities[$this->l('Suppliers')]:
             //Overwrite validators AS name is not MultiLangField
             self::$validators = array('description' => array('AdminImportController', 'createMultiLangField'), 'short_description' => array('AdminImportController', 'createMultiLangField'), 'meta_title' => array('AdminImportController', 'createMultiLangField'), 'meta_keywords' => array('AdminImportController', 'createMultiLangField'), 'meta_description' => array('AdminImportController', 'createMultiLangField'));
             $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->l('ID')), 'active' => array('label' => $this->l('Active (0/1)')), 'name' => array('label' => $this->l('Name *')), 'description' => array('label' => $this->l('Description')), 'short_description' => array('label' => $this->l('Short description')), 'meta_title' => array('label' => $this->l('Meta title')), 'meta_keywords' => array('label' => $this->l('Meta keywords')), 'meta_description' => array('label' => $this->l('Meta description')), 'shop' => array('label' => $this->l('ID / Name of group shop'), 'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.')));
             self::$default_values = array('shop' => Shop::getGroupFromShop(Configuration::get('PS_SHOP_DEFAULT')));
             break;
             // @since 1.5.0
         // @since 1.5.0
         case $this->entities[$this->l('Supply Orders')]:
             if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
                 // required fields
                 $this->required_fields = array('id_supplier', 'id_warehouse', 'reference', 'date_delivery_expected');
                 // available fields
                 $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->l('ID')), 'id_supplier' => array('label' => $this->l('Supplier ID *')), 'id_lang' => array('label' => $this->l('Lang ID')), 'id_warehouse' => array('label' => $this->l('Warehouse ID *')), 'id_currency' => array('label' => $this->l('Currency ID *')), 'reference' => array('label' => $this->l('Supply Order Reference *')), 'date_delivery_expected' => array('label' => $this->l('Delivery Date (Y-M-D)*')), 'discount_rate' => array('label' => $this->l('Discount Rate')), 'is_template' => array('label' => $this->l('Template')));
                 // default values
                 self::$default_values = array('id_lang' => (int) Configuration::get('PS_LANG_DEFAULT'), 'id_currency' => Currency::getDefaultCurrency()->id, 'discount_rate' => '0', 'is_template' => '0');
             }
             break;
             // @since 1.5.0
         // @since 1.5.0
         case $this->entities[$this->l('Supply Order Details')]:
             if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
                 // required fields
                 $this->required_fields = array('supply_order_reference', 'id_product', 'unit_price_te', 'quantity_expected');
                 // available fields
                 $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'supply_order_reference' => array('label' => $this->l('Supply Order Reference *')), 'id_product' => array('label' => $this->l('Product ID *')), 'id_product_attribute' => array('label' => $this->l('Product Attribute ID')), 'unit_price_te' => array('label' => $this->l('Unit Price (tax excl.)*')), 'quantity_expected' => array('label' => $this->l('Quantity Expected *')), 'discount_rate' => array('label' => $this->l('Discount Rate')), 'tax_rate' => array('label' => $this->l('Tax Rate')));
                 // default values
                 self::$default_values = array('discount_rate' => '0', 'tax_rate' => '0');
             }
     }
     $this->separator = strval(trim(Tools::getValue('separator', ';')));
     if (is_null(Tools::getValue('multiple_value_separator')) || trim(Tools::getValue('multiple_value_separator')) == '') {
         $this->multiple_value_separator = ',';
     } else {
         $this->multiple_value_separator = Tools::getValue('multiple_value_separator');
     }
     parent::__construct();
 }
 public static function getMaskedRow($row)
 {
     return array_map('trim', parent::getMaskedRow($row));
 }
 public function postProcess()
 {
     if (_PS_MODE_DEMO_ || !Tools::getValue('import') || !Tools::getValue('csv')) {
         parent::postProcess();
         return;
     }
     $db = Db::getInstance();
     $db->query("SET AUTOCOMMIT = 0");
     $db->query("START TRANSACTION");
     parent::postProcess();
     $db->query("COMMIT");
 }