[*] BO : AdminImport add img manufacturers-suppliers

This commit is contained in:
indesign47
2013-10-24 15:44:11 +02:00
parent 2ffc296279
commit ea8a5277f2
+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
} }
} }
} }
?> ?>