From 02bf347621f9e11f3ad8bc0c8eaed613aaa2502f Mon Sep 17 00:00:00 2001 From: lLefevre Date: Fri, 28 Oct 2011 13:01:20 +0000 Subject: [PATCH] // Fix added GroupShop Manufacturer --- .../themes/template/helper/form/form_shop.tpl | 2 +- .../admin/AdminManufacturersController.php | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/admin-dev/themes/template/helper/form/form_shop.tpl b/admin-dev/themes/template/helper/form/form_shop.tpl index 199ac05ae..4d54202c2 100644 --- a/admin-dev/themes/template/helper/form/form_shop.tpl +++ b/admin-dev/themes/template/helper/form/form_shop.tpl @@ -101,7 +101,7 @@ function check_all_shop() {ldelim} - {if $input.type = 'shop'} + {if $input.type == 'shop'} {assign var=j value=0} {foreach $groupData['shops'] as $shopID => $shopData} {if ((isset($fields_value.shop[$shopID]) && in_array($form_id, $fields_value.shop[$shopID])) || !$form_id)} diff --git a/controllers/admin/AdminManufacturersController.php b/controllers/admin/AdminManufacturersController.php index 52c567cab..83c00e5d5 100644 --- a/controllers/admin/AdminManufacturersController.php +++ b/controllers/admin/AdminManufacturersController.php @@ -303,6 +303,9 @@ class AdminManufacturersControllerCore extends AdminController ) ); + if (!($manufacturer = $this->loadObject(true))) + return; + /* * Where it used? You can not insert into a table or in the fields of a table */ @@ -321,9 +324,6 @@ class AdminManufacturersControllerCore extends AdminController 'class' => 'button' ); - if (!($manufacturer = $this->loadObject(true))) - return; - $image = cacheImage(_PS_MANU_IMG_DIR_.'/'.$manufacturer->id.'.jpg', $this->table.'_'.(int)$manufacturer->id.'.'.$this->imageType, 350, $this->imageType, true); $this->fields_value = array( @@ -346,6 +346,17 @@ class AdminManufacturersControllerCore extends AdminController )), ENT_COMPAT, 'UTF-8'); } + //Added values of object Shop + if ($manufacturer->id) + { + $assos = array(); + $sql = 'SELECT `id_group_shop`, `'.pSQL($this->identifier).'` + FROM `'._DB_PREFIX_.pSQL($this->table).'_group_shop` + WHERE `'.pSQL($this->identifier).'` = '.(int)$manufacturer->id; + foreach (Db::getInstance()->executeS($sql) as $row) + $this->fields_value['shop'][$row['id_group_shop']][] = $row[$this->identifier]; + } + return parent::initForm(); }