// Some fix + multistore for import tools
This commit is contained in:
+203
-120
@@ -79,7 +79,6 @@ class AdminImport extends AdminTab
|
|||||||
switch ((int)(Tools::getValue('entity')))
|
switch ((int)(Tools::getValue('entity')))
|
||||||
{
|
{
|
||||||
case $this->entities[$this->l('Combinations')]:
|
case $this->entities[$this->l('Combinations')]:
|
||||||
|
|
||||||
self::$required_fields = array('id_product', 'options');
|
self::$required_fields = array('id_product', 'options');
|
||||||
$this->available_fields = array(
|
$this->available_fields = array(
|
||||||
'no' => array('label' => $this->l('Ignore this column')),
|
'no' => array('label' => $this->l('Ignore this column')),
|
||||||
@@ -109,159 +108,179 @@ class AdminImport extends AdminTab
|
|||||||
'weight' => 0,
|
'weight' => 0,
|
||||||
'default_on' => 0
|
'default_on' => 0
|
||||||
);
|
);
|
||||||
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case $this->entities[$this->l('Categories')]:
|
case $this->entities[$this->l('Categories')]:
|
||||||
|
|
||||||
$this->available_fields = array(
|
$this->available_fields = array(
|
||||||
'no' => array('label' => $this->l('Ignore this column')),
|
'no' => array('label' => $this->l('Ignore this column')),
|
||||||
'id' => array('label' => $this->l('ID')),
|
'id' => array('label' => $this->l('ID')),
|
||||||
'active' => array('label' => $this->l('Active (0/1)')),
|
'active' => array('label' => $this->l('Active (0/1)')),
|
||||||
'name' => array('label' => $this->l('Name *')),
|
'name' => array('label' => $this->l('Name *')),
|
||||||
'parent' => array('label' => $this->l('Parent category')),
|
'parent' => array('label' => $this->l('Parent category')),
|
||||||
'description' => array('label' => $this->l('Description')),
|
'description' => array('label' => $this->l('Description')),
|
||||||
'meta_title' => array('label' => $this->l('Meta-title')),
|
'meta_title' => array('label' => $this->l('Meta-title')),
|
||||||
'meta_keywords' => array('label' => $this->l('Meta-keywords')),
|
'meta_keywords' => array('label' => $this->l('Meta-keywords')),
|
||||||
'meta_description' => array('label' => $this->l('Meta-description')),
|
'meta_description' => array('label' => $this->l('Meta-description')),
|
||||||
'link_rewrite' => array('label' => $this->l('URL rewritten')),
|
'link_rewrite' => array('label' => $this->l('URL rewritten')),
|
||||||
'image' => array('label' => $this->l('Image URL')));
|
'image' => array('label' => $this->l('Image URL')),
|
||||||
|
);
|
||||||
|
|
||||||
self::$default_values = array('active' => '1', 'parent' => '1', 'link_rewrite' => '');
|
self::$default_values = array('active' => '1', 'parent' => '1', 'link_rewrite' => '');
|
||||||
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case $this->entities[$this->l('Products')]:
|
case $this->entities[$this->l('Products')]:
|
||||||
|
|
||||||
self::$validators['image'] = array('AdminImport', 'split');
|
self::$validators['image'] = array('AdminImport', 'split');
|
||||||
|
|
||||||
$this->available_fields = array(
|
$this->available_fields = array(
|
||||||
'no' => array('label' => $this->l('Ignore this column')),
|
'no' => array('label' => $this->l('Ignore this column')),
|
||||||
'id' => array('label' => $this->l('ID')),
|
'id' => array('label' => $this->l('ID')),
|
||||||
'active' => array('label' => $this->l('Active (0/1)')),
|
'active' => array('label' => $this->l('Active (0/1)')),
|
||||||
'name' => array('label' => $this->l('Name *')),
|
'name' => array('label' => $this->l('Name *')),
|
||||||
'category' => array('label' => $this->l('Categories (x,y,z...)')),
|
'category' => array('label' => $this->l('Categories (x,y,z...)')),
|
||||||
'price_tex' => array('label' => $this->l('Price tax excl.')),
|
'price_tex' => array('label' => $this->l('Price tax excl.')),
|
||||||
'price_tin' => array('label' => $this->l('Price tax incl.')),
|
'price_tin' => array('label' => $this->l('Price tax incl.')),
|
||||||
'id_tax_rules_group' => array('label' => $this->l('Tax rules id')),
|
'id_tax_rules_group' => array('label' => $this->l('Tax rules id')),
|
||||||
'wholesale_price' => array('label' => $this->l('Wholesale price')),
|
'wholesale_price' => array('label' => $this->l('Wholesale price')),
|
||||||
'on_sale' => array('label' => $this->l('On sale (0/1)')),
|
'on_sale' => array('label' => $this->l('On sale (0/1)')),
|
||||||
'reduction_price' => array('label' => $this->l('Discount amount')),
|
'reduction_price' => array('label' => $this->l('Discount amount')),
|
||||||
'reduction_percent' => array('label' => $this->l('Discount percent')),
|
'reduction_percent' => array('label' => $this->l('Discount percent')),
|
||||||
'reduction_from' => array('label' => $this->l('Discount from (yyyy-mm-dd)')),
|
'reduction_from' => array('label' => $this->l('Discount from (yyyy-mm-dd)')),
|
||||||
'reduction_to' => array('label' => $this->l('Discount to (yyyy-mm-dd)')),
|
'reduction_to' => array('label' => $this->l('Discount to (yyyy-mm-dd)')),
|
||||||
'reference' => array('label' => $this->l('Reference #')),
|
'reference' => array('label' => $this->l('Reference #')),
|
||||||
'supplier_reference' => array('label' => $this->l('Supplier reference #')),
|
'supplier_reference' => array('label' => $this->l('Supplier reference #')),
|
||||||
'supplier' => array('label' => $this->l('Supplier')),
|
'supplier' => array('label' => $this->l('Supplier')),
|
||||||
'manufacturer' => array('label' => $this->l('Manufacturer')),
|
'manufacturer' => array('label' => $this->l('Manufacturer')),
|
||||||
'ean13' => array('label' => $this->l('EAN13')),
|
'ean13' => array('label' => $this->l('EAN13')),
|
||||||
'upc' => array('label' => $this->l('UPC')),
|
'upc' => array('label' => $this->l('UPC')),
|
||||||
'ecotax' => array('label' => $this->l('Ecotax')),
|
'ecotax' => array('label' => $this->l('Ecotax')),
|
||||||
'weight' => array('label' => $this->l('Weight')),
|
'weight' => array('label' => $this->l('Weight')),
|
||||||
'quantity' => array('label' => $this->l('Quantity')),
|
'quantity' => array('label' => $this->l('Quantity')),
|
||||||
'description_short' => array('label' => $this->l('Short description')),
|
'description_short' => array('label' => $this->l('Short description')),
|
||||||
'description' => array('label' => $this->l('Description')),
|
'description' => array('label' => $this->l('Description')),
|
||||||
'tags' => array('label' => $this->l('Tags (x,y,z...)')),
|
'tags' => array('label' => $this->l('Tags (x,y,z...)')),
|
||||||
'meta_title' => array('label' => $this->l('Meta-title')),
|
'meta_title' => array('label' => $this->l('Meta-title')),
|
||||||
'meta_keywords' => array('label' => $this->l('Meta-keywords')),
|
'meta_keywords' => array('label' => $this->l('Meta-keywords')),
|
||||||
'meta_description' => array('label' => $this->l('Meta-description')),
|
'meta_description' => array('label' => $this->l('Meta-description')),
|
||||||
'link_rewrite' => array('label' => $this->l('URL rewritten')),
|
'link_rewrite' => array('label' => $this->l('URL rewritten')),
|
||||||
'available_now' => array('label' => $this->l('Text when in-stock')),
|
'available_now' => array('label' => $this->l('Text when in-stock')),
|
||||||
'available_later' => array('label' => $this->l('Text if back-order allowed')),
|
'available_later' => array('label' => $this->l('Text if back-order allowed')),
|
||||||
'image' => array('label' => $this->l('Image URLs (x,y,z...)')),
|
'image' => array('label' => $this->l('Image URLs (x,y,z...)')),
|
||||||
'delete_existing_images' => array(
|
'delete_existing_images' => array(
|
||||||
'label' => $this->l('Delete existing images (0 = no, 1 = yes)'),
|
'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')),
|
'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')),
|
'feature' => array('label' => $this->l('Feature')),
|
||||||
'condition' => array('label' => $this->l('Condition')));
|
'online_only' => array('label' => $this->l('Only available online')),
|
||||||
|
'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 multishop tool. If you leave this field empty, default shop will be used'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
self::$default_values = array(
|
self::$default_values = array(
|
||||||
'id_category' => array(1),
|
'id_category' => array(1),
|
||||||
'id_category_default' => 1,
|
'id_category_default' => 1,
|
||||||
'active' => '1',
|
'active' => '1',
|
||||||
'quantity' => 0,
|
'quantity' => 0,
|
||||||
'price' => 0,
|
'price' => 0,
|
||||||
'id_tax_rules_group' => 0,
|
'id_tax_rules_group' => 0,
|
||||||
'description_short' => array((int)(Configuration::get('PS_LANG_DEFAULT')) => ''),
|
'description_short' => array((int)(Configuration::get('PS_LANG_DEFAULT')) => ''),
|
||||||
'link_rewrite' => array((int)(Configuration::get('PS_LANG_DEFAULT')) => ''),
|
'link_rewrite' => array((int)(Configuration::get('PS_LANG_DEFAULT')) => ''),
|
||||||
'online_only' => 0,
|
'online_only' => 0,
|
||||||
'condition' => 'new');
|
'condition' => 'new',
|
||||||
|
'shop' => Configuration::get('PS_SHOP_DEFAULT'),
|
||||||
break;
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
case $this->entities[$this->l('Customers')]:
|
case $this->entities[$this->l('Customers')]:
|
||||||
|
|
||||||
//Overwrite required_fields AS only email is required whereas other entities
|
//Overwrite required_fields AS only email is required whereas other entities
|
||||||
self::$required_fields = array('email', 'passwd', 'lastname', 'firstname');
|
self::$required_fields = array('email', 'passwd', 'lastname', 'firstname');
|
||||||
|
|
||||||
$this->available_fields = array(
|
$this->available_fields = array(
|
||||||
'no' => array('label' => $this->l('Ignore this column')),
|
'no' => array('label' => $this->l('Ignore this column')),
|
||||||
'id' => array('label' => $this->l('ID')),
|
'id' => array('label' => $this->l('ID')),
|
||||||
'active' => array('label' => $this->l('Active (0/1)')),
|
'active' => array('label' => $this->l('Active (0/1)')),
|
||||||
'id_gender' => array('label' => $this->l('Gender ID (Mr = 1, Ms = 2, else 9)')),
|
'id_gender' => array('label' => $this->l('Gender ID (Mr = 1, Ms = 2, else 9)')),
|
||||||
'email' => array('label' => $this->l('E-mail *')),
|
'email' => array('label' => $this->l('E-mail *')),
|
||||||
'passwd' => array('label' => $this->l('Password *')),
|
'passwd' => array('label' => $this->l('Password *')),
|
||||||
'birthday' => array('label' => $this->l('Birthday (yyyy-mm-dd)')),
|
'birthday' => array('label' => $this->l('Birthday (yyyy-mm-dd)')),
|
||||||
'lastname' => array('label' => $this->l('Lastname *')),
|
'lastname' => array('label' => $this->l('Lastname *')),
|
||||||
'firstname' => array('label' => $this->l('Firstname *')),
|
'firstname' => array('label' => $this->l('Firstname *')),
|
||||||
'newsletter' => array('label' => $this->l('Newsletter (0/1)')),
|
'newsletter' => array('label' => $this->l('Newsletter (0/1)')),
|
||||||
'optin' => array('label' => $this->l('Opt in (0/1)')));
|
'optin' => array('label' => $this->l('Opt in (0/1)')),
|
||||||
|
'id_shop' => array(
|
||||||
self::$default_values = array('active' => '1');
|
'label' => $this->l('ID / Name of shop'),
|
||||||
|
'help' => $this->l('Ignore this field if you don\'t use multishop tool. If you leave this field empty, default shop will be used'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$default_values = array(
|
||||||
|
'active' => '1',
|
||||||
|
'id_shop' => Configuration::get('PS_SHOP_DEFAULT'),
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case $this->entities[$this->l('Addresses')]:
|
|
||||||
|
|
||||||
|
case $this->entities[$this->l('Addresses')]:
|
||||||
//Overwrite required_fields
|
//Overwrite required_fields
|
||||||
self::$required_fields = array('lastname', 'firstname', 'address1', 'postcode', 'country', 'city');
|
self::$required_fields = array('lastname', 'firstname', 'address1', 'postcode', 'country', 'city');
|
||||||
|
|
||||||
$this->available_fields = array(
|
$this->available_fields = array(
|
||||||
'no' => array('label' => $this->l('Ignore this column')),
|
'no' => array('label' => $this->l('Ignore this column')),
|
||||||
'id' => array('label' => $this->l('ID')),
|
'id' => array('label' => $this->l('ID')),
|
||||||
'alias' => array('label' => $this->l('Alias *')),
|
'alias' => array('label' => $this->l('Alias *')),
|
||||||
'active' => array('label' => $this->l('Active (0/1)')),
|
'active' => array('label' => $this->l('Active (0/1)')),
|
||||||
'customer_email' => array('label' => $this->l('Customer e-mail')),
|
'customer_email' => array('label' => $this->l('Customer e-mail')),
|
||||||
'manufacturer' => array('label' => $this->l('Manufacturer')),
|
'manufacturer' => array('label' => $this->l('Manufacturer')),
|
||||||
'supplier' => array('label' => $this->l('Supplier')),
|
'supplier' => array('label' => $this->l('Supplier')),
|
||||||
'company' => array('label' => $this->l('Company')),
|
'company' => array('label' => $this->l('Company')),
|
||||||
'lastname' => array('label' => $this->l('Lastname *')),
|
'lastname' => array('label' => $this->l('Lastname *')),
|
||||||
'firstname' => array('label' => $this->l('Firstname *')),
|
'firstname' => array('label' => $this->l('Firstname *')),
|
||||||
'address1' => array('label' => $this->l('Address 1 *')),
|
'address1' => array('label' => $this->l('Address 1 *')),
|
||||||
'address2' => array('label' => $this->l('Address 2')),
|
'address2' => array('label' => $this->l('Address 2')),
|
||||||
'postcode' => array('label' => $this->l('Postcode*/ Zipcode*')),
|
'postcode' => array('label' => $this->l('Postcode*/ Zipcode*')),
|
||||||
'city' => array('label' => $this->l('City *')),
|
'city' => array('label' => $this->l('City *')),
|
||||||
'country' => array('label' => $this->l('Country *')),
|
'country' => array('label' => $this->l('Country *')),
|
||||||
'state' => array('label' => $this->l('State')),
|
'state' => array('label' => $this->l('State')),
|
||||||
'other' => array('label' => $this->l('Other')),
|
'other' => array('label' => $this->l('Other')),
|
||||||
'phone' => array('label' => $this->l('Phone')),
|
'phone' => array('label' => $this->l('Phone')),
|
||||||
'phone_mobile' => array('label' => $this->l('Mobile Phone')),
|
'phone_mobile' => array('label' => $this->l('Mobile Phone')),
|
||||||
'vat_number' => array('label' => $this->l('VAT number')));
|
'vat_number' => array('label' => $this->l('VAT number')),
|
||||||
|
);
|
||||||
|
|
||||||
self::$default_values = array('alias' => 'Alias', 'postcode' => 'X');
|
self::$default_values = array('alias' => 'Alias', 'postcode' => 'X');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case $this->entities[$this->l('Manufacturers')]:
|
case $this->entities[$this->l('Manufacturers')]:
|
||||||
case $this->entities[$this->l('Suppliers')]:
|
case $this->entities[$this->l('Suppliers')]:
|
||||||
|
|
||||||
//Overwrite validators AS name is not MultiLangField
|
//Overwrite validators AS name is not MultiLangField
|
||||||
self::$validators = array(
|
self::$validators = array(
|
||||||
'description' => array('AdminImport', 'createMultiLangField'),
|
'description' => array('AdminImport', 'createMultiLangField'),
|
||||||
'description_short' => array('AdminImport', 'createMultiLangField'),
|
'description_short' => array('AdminImport', 'createMultiLangField'),
|
||||||
'meta_title' => array('AdminImport', 'createMultiLangField'),
|
'meta_title' => array('AdminImport', 'createMultiLangField'),
|
||||||
'meta_keywords' => array('AdminImport', 'createMultiLangField'),
|
'meta_keywords' => array('AdminImport', 'createMultiLangField'),
|
||||||
'meta_description' => array('AdminImport', 'createMultiLangField'));
|
'meta_description' => array('AdminImport', 'createMultiLangField'),
|
||||||
|
);
|
||||||
|
|
||||||
$this->available_fields = array(
|
$this->available_fields = array(
|
||||||
'no' => array('label' => $this->l('Ignore this column')),
|
'no' => array('label' => $this->l('Ignore this column')),
|
||||||
'id' => array('label' => $this->l('ID')),
|
'id' => array('label' => $this->l('ID')),
|
||||||
'active' => array('label' => $this->l('Active (0/1)')),
|
'active' => array('label' => $this->l('Active (0/1)')),
|
||||||
'name' => array('label' => $this->l('Name *')),
|
'name' => array('label' => $this->l('Name *')),
|
||||||
'description' => array('label' => $this->l('Description')),
|
'description' => array('label' => $this->l('Description')),
|
||||||
'short_description' => array('label' => $this->l('Short description')),
|
'short_description' => array('label' => $this->l('Short description')),
|
||||||
'meta_title' => array('label' => $this->l('Meta-title')),
|
'meta_title' => array('label' => $this->l('Meta-title')),
|
||||||
'meta_keywords' => array('label' => $this->l('Meta-keywords')),
|
'meta_keywords' => array('label' => $this->l('Meta-keywords')),
|
||||||
'meta_description' => array('label' => $this->l('Meta-description')));
|
'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 multishop tool. If you leave this field empty, default shop will be used'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$default_values = array(
|
||||||
|
'shop' => Shop::getGroupFromShop(Configuration::get('PS_SHOP_DEFAULT')),
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -727,6 +746,7 @@ class AdminImport extends AdminTab
|
|||||||
// check quantity
|
// check quantity
|
||||||
if ($product->quantity == NULL)
|
if ($product->quantity == NULL)
|
||||||
$product->quantity = 0;
|
$product->quantity = 0;
|
||||||
|
|
||||||
// If id product AND id product already in base, trying to update
|
// If id product AND id product already in base, trying to update
|
||||||
if ($product->id AND Product::existsInDatabase((int)($product->id)))
|
if ($product->id AND Product::existsInDatabase((int)($product->id)))
|
||||||
{
|
{
|
||||||
@@ -748,6 +768,21 @@ class AdminImport extends AdminTab
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Associate product to shop
|
||||||
|
if (Tools::isMultiShopActivated() && $product->shop)
|
||||||
|
{
|
||||||
|
$product->shop = explode(',', $product->shop);
|
||||||
|
$shops = array();
|
||||||
|
foreach ($product->shop as $shop)
|
||||||
|
{
|
||||||
|
$shop = trim($shop);
|
||||||
|
if (!is_numeric($shop))
|
||||||
|
$shop = Shop::getIdByName($shop);
|
||||||
|
$shops[] = $shop;
|
||||||
|
}
|
||||||
|
$product->associateTo($shops);
|
||||||
|
}
|
||||||
|
|
||||||
// SpecificPrice (only the basic reduction feature is supported by the import)
|
// SpecificPrice (only the basic reduction feature is supported by the import)
|
||||||
if ((isset($info['reduction_price']) AND $info['reduction_price'] > 0) OR (isset($info['reduction_percent']) AND $info['reduction_percent'] > 0))
|
if ((isset($info['reduction_price']) AND $info['reduction_price'] > 0) OR (isset($info['reduction_percent']) AND $info['reduction_percent'] > 0))
|
||||||
{
|
{
|
||||||
@@ -930,9 +965,20 @@ class AdminImport extends AdminTab
|
|||||||
if ($customer->passwd)
|
if ($customer->passwd)
|
||||||
$customer->passwd = md5(_COOKIE_KEY_.$customer->passwd);
|
$customer->passwd = md5(_COOKIE_KEY_.$customer->passwd);
|
||||||
|
|
||||||
|
// Associate product to shop
|
||||||
|
if (Tools::isMultiShopActivated() && $customer->id_shop)
|
||||||
|
{
|
||||||
|
if (!is_numeric($customer->id_shop))
|
||||||
|
$customer->id_shop = Shop::getIdByName($customer->id_shop);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$customer->id_shop = Configuration::get('PS_SHOP_DEFAULT');
|
||||||
|
|
||||||
$res = false;
|
$res = false;
|
||||||
if (($fieldError = $customer->validateFields(UNFRIENDLY_ERROR, true)) === true AND ($langFieldError = $customer->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true)
|
if (($fieldError = $customer->validateFields(UNFRIENDLY_ERROR, true)) === true AND ($langFieldError = $customer->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true)
|
||||||
{
|
{
|
||||||
|
$customer->id_group_shop = Shop::getGroupFromShop($customer->id_shop);
|
||||||
|
|
||||||
if ($customer->id AND $customer->customerIdExists($customer->id))
|
if ($customer->id AND $customer->customerIdExists($customer->id))
|
||||||
$res = $customer->update();
|
$res = $customer->update();
|
||||||
if (!$res)
|
if (!$res)
|
||||||
@@ -1104,7 +1150,26 @@ class AdminImport extends AdminTab
|
|||||||
$res = $manufacturer->update();
|
$res = $manufacturer->update();
|
||||||
if (!$res)
|
if (!$res)
|
||||||
$res = $manufacturer->add();
|
$res = $manufacturer->add();
|
||||||
|
|
||||||
|
if ($res)
|
||||||
|
{
|
||||||
|
// Associate supplier to group shop
|
||||||
|
if (Tools::isMultiShopActivated() && $manufacturer->shop)
|
||||||
|
{
|
||||||
|
$manufacturer->shop = explode(',', $manufacturer->shop);
|
||||||
|
$shops = array();
|
||||||
|
foreach ($manufacturer->shop as $shop)
|
||||||
|
{
|
||||||
|
$shop = trim($shop);
|
||||||
|
if (!is_numeric($shop))
|
||||||
|
$shop = GroupShop::getIdByName($shop);
|
||||||
|
$shops[] = $shop;
|
||||||
|
}
|
||||||
|
$manufacturer->associateTo($shops, 'group_shop');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$res)
|
if (!$res)
|
||||||
{
|
{
|
||||||
$this->_errors[] = mysql_error().' '.$info['name'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
$this->_errors[] = mysql_error().' '.$info['name'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
||||||
@@ -1136,8 +1201,26 @@ class AdminImport extends AdminTab
|
|||||||
$res = $supplier->update();
|
$res = $supplier->update();
|
||||||
if (!$res)
|
if (!$res)
|
||||||
$res = $supplier->add();
|
$res = $supplier->add();
|
||||||
|
|
||||||
if (!$res)
|
if (!$res)
|
||||||
$this->_errors[] = mysql_error().' '.$info['name'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
$this->_errors[] = mysql_error().' '.$info['name'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Associate supplier to group shop
|
||||||
|
if (Tools::isMultiShopActivated() && $supplier->shop)
|
||||||
|
{
|
||||||
|
$supplier->shop = explode(',', $supplier->shop);
|
||||||
|
$shops = array();
|
||||||
|
foreach ($supplier->shop as $shop)
|
||||||
|
{
|
||||||
|
$shop = trim($shop);
|
||||||
|
if (!is_numeric($shop))
|
||||||
|
$shop = GroupShop::getIdByName($shop);
|
||||||
|
$shops[] = $shop;
|
||||||
|
}
|
||||||
|
$supplier->associateTo($shops, 'group_shop');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1245,8 +1245,6 @@ class AdminProducts extends AdminTab
|
|||||||
$this->_errors[] = Tools::displayError('An error occurred while adding tags.');
|
$this->_errors[] = Tools::displayError('An error occurred while adding tags.');
|
||||||
elseif ($id_image = $this->addProductImage($object))
|
elseif ($id_image = $this->addProductImage($object))
|
||||||
{
|
{
|
||||||
$object->setStock($object->quantity);
|
|
||||||
|
|
||||||
Hook::addProduct($object);
|
Hook::addProduct($object);
|
||||||
Search::indexation(false);
|
Search::indexation(false);
|
||||||
|
|
||||||
|
|||||||
@@ -125,4 +125,17 @@ class GroupShopCore extends ObjectModel
|
|||||||
FROM '._DB_PREFIX_.'shop s
|
FROM '._DB_PREFIX_.'shop s
|
||||||
WHERE id_group_shop='.(int)$this->id);
|
WHERE id_group_shop='.(int)$this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a group shop ID from group shop name
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function getIdByName($name)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT id_group_shop FROM '._DB_PREFIX_.'group_shop
|
||||||
|
WHERE name = \''.pSQL($name).'\'';
|
||||||
|
return (int)Db::getInstance()->getValue($sql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,13 +237,13 @@ abstract class ObjectModelCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Tools::isMultishopActivated())
|
if (!Tools::isMultishopActivated())
|
||||||
{
|
{
|
||||||
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'shop')
|
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'shop')
|
||||||
$result &= $this->associateTo(array((int)Shop::getCurrentShop(true)), 'shop');
|
$result &= $this->associateTo(Shop::getCurrentShop(true), 'shop');
|
||||||
$assos = GroupShop::getAssoTables();
|
$assos = GroupShop::getAssoTables();
|
||||||
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'group_shop')
|
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'group_shop')
|
||||||
$result &= $this->associateTo(array((int)Shop::getCurrentGroupShop()), 'group_shop');
|
$result &= $this->associateTo(Shop::getCurrentGroupShop(), 'group_shop');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -363,6 +363,14 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function add($autodate = true, $nullValues = false)
|
||||||
|
{
|
||||||
|
if (!parent::add($autodate, $nullValues))
|
||||||
|
return false;
|
||||||
|
$this->setStock($this->quantity);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check then return multilingual fields for database interaction
|
* Check then return multilingual fields for database interaction
|
||||||
|
|||||||
+19
-3
@@ -168,8 +168,7 @@ class ShopCore extends ObjectModel
|
|||||||
FROM '._DB_PREFIX_.'group_shop gs
|
FROM '._DB_PREFIX_.'group_shop gs
|
||||||
LEFT JOIN '._DB_PREFIX_.'shop s
|
LEFT JOIN '._DB_PREFIX_.'shop s
|
||||||
ON (s.id_group_shop = gs.id_group_shop)
|
ON (s.id_group_shop = gs.id_group_shop)
|
||||||
WHERE s.active = 1
|
WHERE s.deleted = 0
|
||||||
AND s.deleted = 0
|
|
||||||
AND gs.deleted = 0
|
AND gs.deleted = 0
|
||||||
ORDER BY gs.name, s.name';
|
ORDER BY gs.name, s.name';
|
||||||
if ($results = Db::getInstance()->ExecuteS($sql))
|
if ($results = Db::getInstance()->ExecuteS($sql))
|
||||||
@@ -227,6 +226,22 @@ class ShopCore extends ObjectModel
|
|||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a shop ID from shop name
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function getIdByName($name)
|
||||||
|
{
|
||||||
|
Shop::loadShops();
|
||||||
|
foreach (self::$shops as $groupData)
|
||||||
|
foreach ($groupData['shops'] as $shopID => $shopData)
|
||||||
|
if (Tools::strtolower($shopData['name']) == Tools::strtolower($name))
|
||||||
|
return $shopID;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int Total of shops
|
* @return int Total of shops
|
||||||
*/
|
*/
|
||||||
@@ -536,7 +551,8 @@ class ShopCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$html .= '<option class="group" value="g-'.$gID.'" '.(($value == 'g-'.$gID) ? 'selected="selected"' : '').'>'.htmlspecialchars($groupData['name']).'</option>';
|
$html .= '<option class="group" value="g-'.$gID.'" '.(($value == 'g-'.$gID) ? 'selected="selected"' : '').'>'.htmlspecialchars($groupData['name']).'</option>';
|
||||||
foreach ($groupData['shops'] as $sID => $shopData)
|
foreach ($groupData['shops'] as $sID => $shopData)
|
||||||
$html .= '<option value="s-'.$sID.'" class="shop" '.(($value == 's-'.$sID) ? 'selected="selected"' : '').'>» '.$shopData['name'].'</option>';
|
if ($shopData['active'])
|
||||||
|
$html .= '<option value="s-'.$sID.'" class="shop" '.(($value == 's-'.$sID) ? 'selected="selected"' : '').'>» '.$shopData['name'].'</option>';
|
||||||
}
|
}
|
||||||
$html .= '</select>';
|
$html .= '</select>';
|
||||||
|
|
||||||
|
|||||||
@@ -1166,6 +1166,8 @@ $_LANGADM['AdminImporte6691747add3b37b9c381b8d9476fd4c'] = 'Si vous ne spécifie
|
|||||||
$_LANGADM['AdminImport21021ea0e52be8e9c599f4dff41e5be0'] = 'Caractéristique';
|
$_LANGADM['AdminImport21021ea0e52be8e9c599f4dff41e5be0'] = 'Caractéristique';
|
||||||
$_LANGADM['AdminImport71d0ceacdf562024f2d4c3a76d3b63e4'] = 'Uniquement disponible en ligne';
|
$_LANGADM['AdminImport71d0ceacdf562024f2d4c3a76d3b63e4'] = 'Uniquement disponible en ligne';
|
||||||
$_LANGADM['AdminImport9e2941b3c81256fac10392aaca4ccfde'] = 'Etat';
|
$_LANGADM['AdminImport9e2941b3c81256fac10392aaca4ccfde'] = 'Etat';
|
||||||
|
$_LANGADM['AdminImportf8a0fa3674c3336359b77bbe8e942a2c'] = 'ID ou nom de la boutique';
|
||||||
|
$_LANGADM['AdminImport938159766a881db62185b53e5119b3bd'] = 'Ignorez ce champ si vous n\'utilisez pas la fonction multi-boutique. Si vous laissez ce champ vide, la boutique par défaut sera utilisée';
|
||||||
$_LANGADM['AdminImporta10d0bff85112a2b35f885a38088cd20'] = 'Actif (0/1)';
|
$_LANGADM['AdminImporta10d0bff85112a2b35f885a38088cd20'] = 'Actif (0/1)';
|
||||||
$_LANGADM['AdminImport892b3288390ef6ba2f710255a88cff45'] = 'Genre (M = 1, Mme = 2, sinon 9)';
|
$_LANGADM['AdminImport892b3288390ef6ba2f710255a88cff45'] = 'Genre (M = 1, Mme = 2, sinon 9)';
|
||||||
$_LANGADM['AdminImportfd90e8dd48a4f75b240cc0f87b1da451'] = 'Email *';
|
$_LANGADM['AdminImportfd90e8dd48a4f75b240cc0f87b1da451'] = 'Email *';
|
||||||
@@ -1188,6 +1190,7 @@ $_LANGADM['AdminImport6311ae17c1ee52b36e68aaf4ad066387'] = 'Complément';
|
|||||||
$_LANGADM['AdminImportbcc254b55c4a1babdf1dcb82c207506b'] = 'Téléphone';
|
$_LANGADM['AdminImportbcc254b55c4a1babdf1dcb82c207506b'] = 'Téléphone';
|
||||||
$_LANGADM['AdminImport5020eaae41baf0caa37bcb73b4a12934'] = 'Téléphone mobile';
|
$_LANGADM['AdminImport5020eaae41baf0caa37bcb73b4a12934'] = 'Téléphone mobile';
|
||||||
$_LANGADM['AdminImport7cb32e708d6b961d476baced73d362bb'] = 'Numéro TVA';
|
$_LANGADM['AdminImport7cb32e708d6b961d476baced73d362bb'] = 'Numéro TVA';
|
||||||
|
$_LANGADM['AdminImport3d1c10fcfac7da07fdb8b9f99d1c0901'] = 'ID ou nom du groupe de boutique';
|
||||||
$_LANGADM['AdminImporte81c4e4f2b7b93b481e13a8553c2ae1b'] = 'ou';
|
$_LANGADM['AdminImporte81c4e4f2b7b93b481e13a8553c2ae1b'] = 'ou';
|
||||||
$_LANGADM['AdminImport4059b0251f66a18cb56f544728796875'] = 'Infos';
|
$_LANGADM['AdminImport4059b0251f66a18cb56f544728796875'] = 'Infos';
|
||||||
$_LANGADM['AdminImport87aae49bd054f2cfa4b7b395dee5f2d3'] = 'Réduction non valide';
|
$_LANGADM['AdminImport87aae49bd054f2cfa4b7b395dee5f2d3'] = 'Réduction non valide';
|
||||||
@@ -2563,12 +2566,15 @@ $_LANGADM['AdminShopfff0d600f8a0b5e19e88bfb821dd1157'] = 'Images';
|
|||||||
$_LANGADM['AdminShop92318dc9b42eb05bb1c958f0a15d19b9'] = 'Langues';
|
$_LANGADM['AdminShop92318dc9b42eb05bb1c958f0a15d19b9'] = 'Langues';
|
||||||
$_LANGADM['AdminShop2377be3c2ad9b435ba277a73f0f1ca76'] = 'Fabricants';
|
$_LANGADM['AdminShop2377be3c2ad9b435ba277a73f0f1ca76'] = 'Fabricants';
|
||||||
$_LANGADM['AdminShopbf17ac149e2e7a530c677e9bd51d3fd2'] = 'Modules';
|
$_LANGADM['AdminShopbf17ac149e2e7a530c677e9bd51d3fd2'] = 'Modules';
|
||||||
|
$_LANGADM['AdminShop89b58c514d07acaa086ca02b57512dcb'] = 'Points d\'accroches des modules';
|
||||||
|
$_LANGADM['AdminShop6595ee1b0569961d7c678dab991a9a91'] = 'Exceptions des points d\'accroches des modules';
|
||||||
$_LANGADM['AdminShopb6755d218d5f4e1cef9cce9cc39aeda9'] = 'Meta';
|
$_LANGADM['AdminShopb6755d218d5f4e1cef9cce9cc39aeda9'] = 'Meta';
|
||||||
$_LANGADM['AdminShopc269874d047098fef892a344be025303'] = 'Restrictions des pays pour le module de paiement';
|
$_LANGADM['AdminShopc269874d047098fef892a344be025303'] = 'Restrictions des pays pour le module de paiement';
|
||||||
$_LANGADM['AdminShop72cfee7e99f1d0a9df6cb5434fac3665'] = 'Restrictions des groupes d\'utilisateurs pour le module de paiement';
|
$_LANGADM['AdminShop72cfee7e99f1d0a9df6cb5434fac3665'] = 'Restrictions des groupes d\'utilisateurs pour le module de paiement';
|
||||||
$_LANGADM['AdminShop9e43e210cf7bd16b8896636cae3e46b8'] = 'Restrictions des devises pour le module de paiement';
|
$_LANGADM['AdminShop9e43e210cf7bd16b8896636cae3e46b8'] = 'Restrictions des devises pour le module de paiement';
|
||||||
$_LANGADM['AdminShop068f80c7519d0528fb08e82137a72131'] = 'Produits';
|
$_LANGADM['AdminShop068f80c7519d0528fb08e82137a72131'] = 'Produits';
|
||||||
$_LANGADM['AdminShop511e7adbb96dafc5569e4be09da8dc93'] = 'Langue des produits';
|
$_LANGADM['AdminShop511e7adbb96dafc5569e4be09da8dc93'] = 'Langue des produits';
|
||||||
|
$_LANGADM['AdminShop27ce7f8b5623b2e2df568d64cf051607'] = 'Stock';
|
||||||
$_LANGADM['AdminShop821b8ee6937cec96c30fdafbfe836d68'] = 'Magasins';
|
$_LANGADM['AdminShop821b8ee6937cec96c30fdafbfe836d68'] = 'Magasins';
|
||||||
$_LANGADM['AdminShopdad1f8d794ee0dd7753fe75e73b78f31'] = 'Zones';
|
$_LANGADM['AdminShopdad1f8d794ee0dd7753fe75e73b78f31'] = 'Zones';
|
||||||
$_LANGADM['AdminShop75581ca0bd0adf51a757a454503c191d'] = 'Importation de données';
|
$_LANGADM['AdminShop75581ca0bd0adf51a757a454503c191d'] = 'Importation de données';
|
||||||
|
|||||||
Reference in New Issue
Block a user