From 68ed6fac82bf58e670261339640df812c05d08c8 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Fri, 29 Nov 2013 17:06:59 +0100 Subject: [PATCH] [*] CORE : Merge of https://github.com/PrestaShop/PrestaShop/pull/582 --- controllers/front/ProductController.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 97c3bd5ac..2a983da43 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -530,27 +530,26 @@ class ProductControllerCore extends FrontController { // Assign category to the template if ($this->category !== false && Validate::isLoadedObject($this->category) && $this->category->inShop() && $this->category->isAssociatedToShop()) - { $path = Tools::getPath($this->category->id, $this->product->name, true); - $this->context->smarty->assign(array( - 'category' => $this->category, - 'subCategories' => $this->category->getSubCategories($this->context->language->id, true), - 'id_category_current' => (int)$this->category->id, - 'id_category_parent' => (int)$this->category->id_parent, - 'return_category_name' => Tools::safeOutput($this->category->name) - )); - } elseif (Category::inShopStatic($this->product->id_category_default, $this->context->shop)) { - $cat_default = new Category((int)$this->product->id_category_default); - if (Validate::isLoadedObject($cat_default) && $cat_default->active && $cat_default->isAssociatedToShop()) + $this->category = new Category((int)$this->product->id_category_default); + if (Validate::isLoadedObject( $this->category) && $this->category->active && $this->category->isAssociatedToShop()) $path = Tools::getPath((int)$this->product->id_category_default, $this->product->name); } if (!isset($path) || !$path) $path = Tools::getPath((int)$this->context->shop->id_category, $this->product->name); - $this->context->smarty->assign('path', $path); - $this->context->smarty->assign('categories', Category::getHomeCategories($this->context->language->id, true, (int)$this->context->shop->id)); + // various assignements before Hook::exec + $this->context->smarty->assign(array( + 'path' => $path, + 'category' => $this->category, + 'subCategories' => $this->category->getSubCategories($this->context->language->id, true), + 'id_category_current' => (int)$this->category->id, + 'id_category_parent' => (int)$this->category->id_parent, + 'return_category_name' => Tools::safeOutput($this->category->name), + 'categories' => Category::getHomeCategories($this->context->language->id, true, (int)$this->context->shop->id) + )); $this->context->smarty->assign(array('HOOK_PRODUCT_FOOTER' => Hook::exec('displayFooterProduct', array('product' => $this->product, 'category' => $this->category)))); }