Пример #1
0
 public function __construct()
 {
     $this->entities = array_flip(array($this->l('Categories'), $this->l('Products'), $this->l('Combinations'), $this->l('Customers'), $this->l('Addresses'), $this->l('Manufacturers'), $this->l('Suppliers')));
     switch ((int) Tools::getValue('entity')) {
         case $this->entities[$this->l('Combinations')]:
             self::$required_fields = array('id_product', 'options');
             $this->available_fields = array('no' => array('label' => $this->l('Ignore this column')), 'id_product' => array('label' => $this->l('Product ID') . '*'), 'options' => array('label' => $this->l('Options (Group:Value)') . '*'), 'reference' => array('label' => $this->l('Reference')), 'supplier_reference' => array('label' => $this->l('Supplier 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('Price')), 'ecotax' => array('label' => $this->l('Ecotax')), 'quantity' => array('label' => $this->l('Quantity')), 'weight' => array('label' => $this->l('Weight')), 'default_on' => array('label' => $this->l('Default')), 'image_position' => array('label' => $this->l('Image position'), 'help' => $this->l('Position of the product image to use for this combination. If you use this field, leave image URL empty.')), 'image_url' => array('label' => $this->l('Image URL')));
             self::$default_values = array('reference' => '', 'supplier_reference' => '', 'ean13' => '', 'upc' => '', 'wholesale_price' => 0, 'price' => 0, 'ecotax' => 0, 'quantity' => 0, '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')), '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')));
             self::$default_values = array('active' => '1', 'parent' => '1', 'link_rewrite' => '');
             break;
         case $this->entities[$this->l('Products')]:
             self::$validators['image'] = array('AdminImport', '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 excl.')), 'price_tin' => array('label' => $this->l('Price tax incl.')), '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 if back-order allowed')), 'available_for_order' => array('label' => $this->l('Available for order')), 'date_add' => array('label' => $this->l('Date add product')), 'show_price' => array('label' => $this->l('Show price')), 'image' => array('label' => $this->l('Image URLs (x,y,z...)')), 'delete_existing_images' => array('label' => $this->l('Delete existing images (0 = no, 1 = yes)'), 'help' => $this->l('If you do not specify this column and you specify the column images, all images of the product will be replaced by those specified in the import file')), 'feature' => array('label' => $this->l('Feature')), 'online_only' => array('label' => $this->l('Only available online')), 'condition' => array('label' => $this->l('Condition')));
             self::$default_values = array('id_category' => array(1), 'id_category_default' => 1, '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, '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
             self::$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('Gender ID (Mr = 1, Ms = 2, else 9)')), 'email' => array('label' => $this->l('E-mail *')), 'passwd' => array('label' => $this->l('Password *')), 'birthday' => array('label' => $this->l('Birthday (yyyy-mm-dd)')), 'lastname' => array('label' => $this->l('Lastname *')), 'firstname' => array('label' => $this->l('Firstname *')), 'newsletter' => array('label' => $this->l('Newsletter (0/1)')), 'optin' => array('label' => $this->l('Opt in (0/1)')));
             self::$default_values = array('active' => '1');
             break;
         case $this->entities[$this->l('Addresses')]:
             //Overwrite required_fields
             self::$required_fields = array('lastname', 'firstname', 'address1', 'postcode', 'country', '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 e-mail')), 'manufacturer' => array('label' => $this->l('Manufacturer')), 'supplier' => array('label' => $this->l('Supplier')), 'company' => array('label' => $this->l('Company')), 'lastname' => array('label' => $this->l('Lastname *')), 'firstname' => array('label' => $this->l('Firstname *')), 'address1' => array('label' => $this->l('Address 1 *')), 'address2' => array('label' => $this->l('Address 2')), 'postcode' => array('label' => $this->l('Postcode*/ 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('AdminImport', 'createMultiLangField'), 'short_description' => array('AdminImport', 'createMultiLangField'), 'meta_title' => array('AdminImport', 'createMultiLangField'), 'meta_keywords' => array('AdminImport', 'createMultiLangField'), 'meta_description' => array('AdminImport', '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')));
             break;
     }
     parent::__construct();
 }
Пример #2
0
 public function __construct()
 {
     $this->entities = array_flip(array($this->l('Categories'), $this->l('Products'), $this->l('Attributes'), $this->l('Customers'), $this->l('Addresses'), $this->l('Manufacturers'), $this->l('Suppliers')));
     switch (intval(Tools::getValue('entity'))) {
         case $this->entities[$this->l('Attributes')]:
             self::$required_fields = array('id_product', 'options');
             $this->available_fields = array('no' => $this->l('Ignore this column'), 'id_product' => $this->l('Product ID'), 'options' => $this->l('Options'), 'reference' => $this->l('Reference'), 'supplier_reference' => $this->l('Supplier reference'), 'ean13' => $this->l('EAN13'), 'wholesale_price' => $this->l('Wholesale price'), 'price' => $this->l('Price'), 'ecotax' => $this->l('Ecotax'), 'quantity' => $this->l('Quantity'), 'weight' => $this->l('Weight'), 'default_on' => $this->l('Default'));
             self::$default_values = array('reference' => '', 'supplier_reference' => '', 'ean13' => '', 'wholesale_price' => 0, 'price' => 0, 'ecotax' => 0, 'quantity' => 0, 'weight' => 0, 'default_on' => 0);
             break;
         case $this->entities[$this->l('Categories')]:
             $this->available_fields = array('no' => $this->l('Ignore this column'), 'id' => $this->l('ID'), 'active' => $this->l('Active (0/1)'), 'name' => $this->l('Name *'), 'parent' => $this->l('Parent category'), 'description' => $this->l('Description'), 'meta_title' => $this->l('Meta-title'), 'meta_keywords' => $this->l('Meta-keywords'), 'meta_description' => $this->l('Meta-description'), 'link_rewrite' => $this->l('URL rewrited'), 'image' => $this->l('Image URL'));
             self::$default_values = array('active' => '1', 'parent' => '1', 'link_rewrite' => '');
             break;
         case $this->entities[$this->l('Products')]:
             self::$validators['image'] = array('AdminImport', 'split');
             $this->available_fields = array('no' => $this->l('Ignore this column'), 'id' => $this->l('ID'), 'active' => $this->l('Active (0/1)'), 'name' => $this->l('Name *'), 'category' => $this->l('Categories (x,y,z...)'), 'price_tex' => $this->l('Price tax excl.'), 'price_tin' => $this->l('Price tax incl.'), 'tax_rate' => $this->l('Tax rate'), 'wholesale_price' => $this->l('Wholesale price'), 'on_sale' => $this->l('On sale (0/1)'), 'reduction_price' => $this->l('Reduction amount'), 'reduction_percent' => $this->l('Reduction per cent'), 'reduction_from' => $this->l('Reduction from (yyyy-mm-dd)'), 'reduction_to' => $this->l('Reduction to (yyyy-mm-dd)'), 'reference' => $this->l('Reference #'), 'supplier_reference' => $this->l('Supplier reference #'), 'supplier' => $this->l('Supplier'), 'manufacturer' => $this->l('Manufacturer'), 'ean13' => $this->l('EAN13'), 'ecotax' => $this->l('Ecotax'), 'weight' => $this->l('Weight'), 'quantity' => $this->l('Quantity'), 'description_short' => $this->l('Short description'), 'description' => $this->l('Description'), 'tags' => $this->l('Tags (x,y,z...)'), 'meta_title' => $this->l('Meta-title'), 'meta_keywords' => $this->l('Meta-keywords'), 'meta_description' => $this->l('Meta-description'), 'available_now' => $this->l('Text when in-stock'), 'available_later' => $this->l('Text if back-order allowed'), 'image' => $this->l('Image URLs (x,y,z...)'), 'feature' => $this->l('Feature'));
             self::$default_values = array('id_category' => array(1), 'id_category_default' => 1, 'active' => '1', 'quantity' => 0, 'price' => 0, 'id_tax' => 0, 'description_short' => array(intval(Configuration::get('PS_LANG_DEFAULT')) => ''), 'link_rewrite' => array(intval(Configuration::get('PS_LANG_DEFAULT')) => ''));
             break;
         case $this->entities[$this->l('Customers')]:
             //Overwrite required_fields AS only email is required whereas other entities
             self::$required_fields = array('email', 'passwd', 'lastname', 'firstname');
             $this->available_fields = array('no' => $this->l('Ignore this column'), 'id' => $this->l('ID'), 'active' => $this->l('Active  (0/1)'), 'id_gender' => $this->l('Gender ID (Mr = 1, Ms = 2, else 9)'), 'email' => $this->l('E-mail *'), 'passwd' => $this->l('Password *'), 'birthday' => $this->l('Birthday (yyyy-mm-dd)'), 'lastname' => $this->l('Lastname *'), 'firstname' => $this->l('Firstname *'), 'newsletter' => $this->l('Newsletter (0/1)'), 'optin' => $this->l('Optin (0/1)'));
             self::$default_values = array('active' => '1');
             break;
         case $this->entities[$this->l('Addresses')]:
             //Overwrite required_fields
             self::$required_fields = array('lastname', 'firstname', 'address1', 'postcode', 'country', 'city');
             $this->available_fields = array('no' => $this->l('Ignore this column'), 'id' => $this->l('ID'), 'alias' => $this->l('Alias *'), 'active' => $this->l('Active  (0/1)'), 'customer_email' => $this->l('Customer e-mail'), 'manufacturer' => $this->l('Manufacturer'), 'supplier' => $this->l('Supplier'), 'company' => $this->l('Company'), 'lastname' => $this->l('Lastname *'), 'firstname' => $this->l('Firstname *'), 'address1' => $this->l('Address 1 *'), 'address2' => $this->l('Address 2'), 'postcode' => $this->l('Postcode *'), 'city' => $this->l('City *'), 'country' => $this->l('Country *'), 'state' => $this->l('State'), 'other' => $this->l('Other'), 'phone' => $this->l('Phone'), 'phone_mobile' => $this->l('Mobile Phone'));
             self::$default_values = array('alias' => 'Alias', 'postcode' => 'X', trunk / img / tmp / product_mini_9 . jpg);
             break;
         case $this->entities[$this->l('Manufacturers')]:
         case $this->entities[$this->l('Suppliers')]:
             //Overwrite validators AS name is not MultiLangField but only description is needed AS MultiLangField
             self::$validators = array('description' => array('AdminImport', 'createMultiLangField'));
             $this->available_fields = array('no' => $this->l('Ignore this column'), 'id' => $this->l('ID'), 'name' => $this->l('Name *'), 'description' => $this->l('Description'));
             break;
     }
     parent::__construct();
 }