From ea8a5277f257a3d25ec5fee4d2f59309c882cccd Mon Sep 17 00:00:00 2001 From: indesign47 Date: Thu, 24 Oct 2013 15:44:11 +0200 Subject: [PATCH] [*] BO : AdminImport add img manufacturers-suppliers --- controllers/admin/AdminImportController.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index ec8c31c92..de6ef7545 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -382,6 +382,7 @@ class AdminImportControllerCore extends AdminController '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.'), @@ -882,6 +883,12 @@ class AdminImportControllerCore extends AdminController case 'categories': $path = _PS_CAT_IMG_DIR_.(int)$id_entity; 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)); @@ -2370,6 +2377,11 @@ class AdminImportControllerCore extends AdminController if (!$res) $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) { // Associate supplier to group shop @@ -2443,6 +2455,11 @@ class AdminImportControllerCore extends AdminController if (!$res) $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) $this->errors[] = Db::getInstance()->getMsgError().' '.sprintf( Tools::displayError('%1$s (ID: %2$s) cannot be saved'), @@ -3100,4 +3117,4 @@ class AdminImportControllerCore extends AdminController } } } -?> \ No newline at end of file +?>