Merge pull request #887 from indesign47/patch-13

[*] BO : AdminImport add img manufacturers-suppliers
This commit is contained in:
Gregory Roussac
2013-10-24 07:22:57 -07:00
4 changed files with 28 additions and 7 deletions
@@ -227,6 +227,10 @@
$(".import_products_categories, label[for=regenerate], #regenerate").show(); $(".import_products_categories, label[for=regenerate], #regenerate").show();
else else
$(".import_products_categories, label[for=regenerate], #regenerate").hide(); $(".import_products_categories, label[for=regenerate], #regenerate").hide();
if ($("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6)
$("label[for=regenerate], #regenerate").show()
else
$("label[for=regenerate], #regenerate").hide();
if ($("#entity > option:selected").val() == 0 || $("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 3 || $("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6 || $("#entity > option:selected").val() == 7) if ($("#entity > option:selected").val() == 0 || $("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 3 || $("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6 || $("#entity > option:selected").val() == 7)
$("label[for=forceIDs], #forceIDs").show(); $("label[for=forceIDs], #forceIDs").show();
else else
+18 -1
View File
@@ -382,6 +382,7 @@ class AdminImportControllerCore extends AdminController
'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')),
'image' => array('label' => $this->l('Image URL')),
'shop' => array( 'shop' => array(
'label' => $this->l('ID / Name of group shop'), '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.'), '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.'),
@@ -882,6 +883,12 @@ class AdminImportControllerCore extends AdminController
case 'categories': case 'categories':
$path = _PS_CAT_IMG_DIR_.(int)$id_entity; $path = _PS_CAT_IMG_DIR_.(int)$id_entity;
break; break;
case 'manufacturers':
$path = _PS_MANU_IMG_DIR_.(int)$id_entity;
break;
case 'suppliers':
$path = _PS_SUPP_IMG_DIR_.(int)$id_entity;
break;
} }
$url = str_replace(' ', '%20', trim($url)); $url = str_replace(' ', '%20', trim($url));
@@ -2370,6 +2377,11 @@ class AdminImportControllerCore extends AdminController
if (!$res) if (!$res)
$res = $manufacturer->add(); $res = $manufacturer->add();
//copying images of manufacturer
if (isset($manufacturer->image) && !empty($manufacturer->image))
if (!AdminImportController::copyImg($manufacturer->id, null, $manufacturer->image, 'manufacturers', !Tools::getValue('regenerate')))
$this->warnings[] = $manufacturer->image.' '.Tools::displayError('cannot be copied.');
if ($res) if ($res)
{ {
// Associate supplier to group shop // Associate supplier to group shop
@@ -2443,6 +2455,11 @@ class AdminImportControllerCore extends AdminController
if (!$res) if (!$res)
$res = $supplier->add(); $res = $supplier->add();
//copying images of suppliers
if (isset($supplier->image) && !empty($supplier->image))
if (!AdminImportController::copyImg($supplier->id, null, $supplier->image, 'suppliers', !Tools::getValue('regenerate')))
$this->warnings[] = $supplier->image.' '.Tools::displayError('cannot be copied.');
if (!$res) if (!$res)
$this->errors[] = Db::getInstance()->getMsgError().' '.sprintf( $this->errors[] = Db::getInstance()->getMsgError().' '.sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'), Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
@@ -3100,4 +3117,4 @@ class AdminImportControllerCore extends AdminController
} }
} }
} }
?> ?>
+3 -3
View File
@@ -1,3 +1,3 @@
id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description;Image URL
1;1;Apple Computer, Inc;;;;; 1;1;Apple Computer, Inc;;;;;http://youdomain.com/img.jpg
2;1;Shure Incorporated;;;;; 2;1;Shure Incorporated;;;;;http://youdomain.com/img.jpg
1 id id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description;Image URL Active (0/1) Name* Description Short description Meta-title Meta-keywords Meta-description
2 1 1;1;Apple Computer, Inc;;;;;http://youdomain.com/img.jpg 1 Apple Computer, Inc
3 2 2;1;Shure Incorporated;;;;;http://youdomain.com/img.jpg 1 Shure Incorporated
+3 -3
View File
@@ -1,3 +1,3 @@
id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description;Image URL
1;1;Applestore;;;;; 1;1;Applestore;;;;;http://youdomain.com/img.jpg
2;1;Shure Online Store;;;;; 2;1;Shure Online Store;;;;;http://youdomain.com/img.jpg
1 id id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description;Image URL Active (0/1) Name* Description Short description Meta-title Meta-keywords Meta-description
2 1 1;1;Applestore;;;;;http://youdomain.com/img.jpg 1 Applestore
3 2 2;1;Shure Online Store;;;;;http://youdomain.com/img.jpg 1 Shure Online Store