From 20842abdf9c6f18aa799ea5aeb3ea74a0625f351 Mon Sep 17 00:00:00 2001 From: vChabot Date: Tue, 15 May 2012 15:51:42 +0000 Subject: [PATCH] [-] BO : BugFix : #PSCFV-2205 : Cannot associate shop with products git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15317 b9a71923-0436-4b27-9f14-aed3839534dd --- .../controllers/products/associations.tpl | 11 ++++++++++- controllers/admin/AdminProductsController.php | 15 ++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/products/associations.tpl b/admin-dev/themes/default/template/controllers/products/associations.tpl index 14489e1c1..dfc0d0bd8 100644 --- a/admin-dev/themes/default/template/controllers/products/associations.tpl +++ b/admin-dev/themes/default/template/controllers/products/associations.tpl @@ -71,8 +71,17 @@
{l s='The default category is the category which is displayed by default.'}
+ {if $is_multishop && !$is_shop_context} + + + + + + {$asso_shop} + + + {/if} -
diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index a7a9134a0..7f1e8ceb8 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -1425,6 +1425,7 @@ class AdminProductsControllerCore extends AdminController $this->updateAccessories($this->object); $this->updatePackItems($this->object); $this->updateDownloadProduct($this->object); + $this->updateAssoShop($this->object->id); if (empty($this->errors)) { @@ -1526,9 +1527,6 @@ class AdminProductsControllerCore extends AdminController { if ($this->isTabSubmitted('Shipping')) $this->addCarriers(); - if ($this->isTabSubmitted('Associations')) - $this->updateAccessories($object); - if ($this->isTabSubmitted('Suppliers')) $this->processSuppliers(); if ($this->isTabSubmitted('Warehouses')) @@ -1547,6 +1545,11 @@ class AdminProductsControllerCore extends AdminController $this->processCustomizationConfiguration(); if ($this->isTabSubmitted('Attachments')) $this->processAttachments(); + if ($this->isTabSubmitted('Associations')) + { + $this->updateAccessories($object); + $this->updateAssoShop($object->id); + } $this->updatePackItems($object); $this->updateDownloadProduct($object, 1); @@ -2553,6 +2556,10 @@ class AdminProductsControllerCore extends AdminController $tab_root = array('id_category' => $root->id, 'name' => $root->name); $helper = new Helper(); + $helper_form = new HelperForm(); + $helper_form->table = 'product'; + $helper_form->identifier = 'id_product'; + $helper_form->id = $product->id; $category_tree = $helper->renderCategoryTree($tab_root, $selected_cat, 'categoryBox', false, true, array(), false, true); $data->assign(array('default_category' => $default_category, 'selected_cat_ids' => implode(',', array_keys($selected_cat)), @@ -2561,6 +2568,8 @@ class AdminProductsControllerCore extends AdminController 'category_tree' => $category_tree, 'product' => $product, 'link' => $this->context->link, + 'asso_shop' => $helper_form->renderAssoShop(), + 'is_multishop' => Shop::isFeatureActive(), 'is_shop_context' => Shop::getContext() == Shop::CONTEXT_SHOP ));