From 9ff33d65cf6c5ec21611c7bca2dd163ab09bce59 Mon Sep 17 00:00:00 2001 From: fGaillard Date: Mon, 2 Jan 2012 10:15:49 +0000 Subject: [PATCH] [-] Classes : #PSTEST-214 : BugFix : TopMenu for shops and groups git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11973 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/shop/Shop.php | 2 +- modules/blocktopmenu/blocktopmenu.php | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php index b15e814c4..95d2d7dea 100644 --- a/classes/shop/Shop.php +++ b/classes/shop/Shop.php @@ -387,7 +387,7 @@ class ShopCore extends ObjectModel { if (defined('_PS_ADMIN_DIR_')) return Shop::getContextGroupID(); - return (int)$this->id_group_shop; + return (isset($this->id_group_shop)) ? (int)$this->id_group_shop : NULL; } /** diff --git a/modules/blocktopmenu/blocktopmenu.php b/modules/blocktopmenu/blocktopmenu.php index b7d9d78e2..b4a49d8e4 100644 --- a/modules/blocktopmenu/blocktopmenu.php +++ b/modules/blocktopmenu/blocktopmenu.php @@ -98,7 +98,7 @@ class blocktopmenu extends Module global $cookie; if(Tools::isSubmit('submitBlocktopmenu')) { - if (Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', Tools::getValue('items'), false, (int)$this->context->shop->id_group_shop, (int)$this->context->shop->id)) + if (Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', Tools::getValue('items'), null, (int)Shop::getGroupID(), (int)$this->context->shop->id)) $this->_html .= $this->displayConfirmation($this->l('Settings Updated')); else $this->_html .= $this->displayError($this->l('Unable to update settings')); @@ -322,16 +322,10 @@ class blocktopmenu extends Module private function getMenuItems() { - if (Context::shop() == Shop::CONTEXT_SHOP) - { - if (!Configuration::isOverridenByCurrentContext('MOD_BLOCKTOPMENU_ITEMS')) - { - $items_shop = Configuration::get('MOD_BLOCKTOPMENU_ITEMS'); - } - } - if (!isset($items_shop)) - $items_shop = ''; - + $group_id = ((int)Shop::getGroupID() == 0) ? null : (int)Shop::getGroupID(); + $shop_id = ((int)$this->context->shop->id == 0) ? null : (int)$this->context->shop->id; + $items_shop = Configuration::get('MOD_BLOCKTOPMENU_ITEMS', null, $group_id, $shop_id); + $items_shop = explode(',', $items_shop); $items_global = Configuration::getGlobalValue('MOD_BLOCKTOPMENU_ITEMS'); $items_global = explode(',', $items_global);