From 683ab16d3ca5429a3e545a35039da9f8202deccd Mon Sep 17 00:00:00 2001 From: rMalie Date: Fri, 24 Feb 2012 08:51:52 +0000 Subject: [PATCH] // Fix shop context call --- classes/Category.php | 4 ++-- controllers/admin/AdminCategoriesController.php | 4 ++-- controllers/admin/AdminManufacturersController.php | 2 +- controllers/admin/AdminSuppliersController.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/classes/Category.php b/classes/Category.php index 93c8a8e35..363d98acc 100644 --- a/classes/Category.php +++ b/classes/Category.php @@ -791,12 +791,12 @@ class CategoryCore extends ObjectModel )' : '0').' AS nbSelectedSubCat FROM `'._DB_PREFIX_.'category` c LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.$shop->addSqlRestrictionOnLang('cl'); - if (Context::getContext()->shop() == Shop::CONTEXT_SHOP && $use_shop_context) + if (Shop::getContext() == Shop::CONTEXT_SHOP && $use_shop_context) $sql .= ' LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (c.`id_category` = cs.`id_category` AND cs.`id_shop` = '.(int)$id_shop.')'; $sql .= ' WHERE `id_lang` = '.(int)$id_lang; - if (Context::getContext()->shop() == Shop::CONTEXT_SHOP && $use_shop_context) + if (Shop::getContext() == Shop::CONTEXT_SHOP && $use_shop_context) $sql .= ' AND cs.`id_shop` = '.(int)$shop->id; $sql .= ' diff --git a/controllers/admin/AdminCategoriesController.php b/controllers/admin/AdminCategoriesController.php index cdf3200e0..7e129a82e 100644 --- a/controllers/admin/AdminCategoriesController.php +++ b/controllers/admin/AdminCategoriesController.php @@ -152,13 +152,13 @@ class AdminCategoriesControllerCore extends AdminController $id_shop = $id ? $id : Configuration::get('PS_SHOP_DEFAULT'); $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (a.`id_category` = cs.`id_category` AND cs.`id_shop` = '.(int)$id_shop.')'; // we add restriction for shop - if (Shop::CONTEXT_SHOP == Context::getContext()->shop() && $is_multishop) + if (Shop::getContext() == Shop::CONTEXT_SHOP && $is_multishop) $this->_where = ' AND cs.`id_shop` = '.(int)Context::getContext()->shop->id; $categories_tree = $this->_category->getParentsCategories(); if (empty($categories_tree) && ($this->_category->id_category != 1 || Tools::isSubmit('id_category')) - && (Shop::CONTEXT_SHOP == Context::getContext()->shop() && !$is_multishop && $count_categories_without_parent > 1)) + && (Shop::getContext() == Shop::CONTEXT_SHOP && !$is_multishop && $count_categories_without_parent > 1)) $categories_tree = array(array('name' => $this->_category->name[$this->context->language->id])); asort($categories_tree); diff --git a/controllers/admin/AdminManufacturersController.php b/controllers/admin/AdminManufacturersController.php index 7e0f3f197..9a2b4f421 100644 --- a/controllers/admin/AdminManufacturersController.php +++ b/controllers/admin/AdminManufacturersController.php @@ -609,7 +609,7 @@ class AdminManufacturersControllerCore extends AdminController 'addresses' => $addresses, 'products' => $products, 'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'), - 'shopContext' => Context::getContext()->shop(), + 'shopContext' => Shop::getContext(), ); return parent::renderView(); diff --git a/controllers/admin/AdminSuppliersController.php b/controllers/admin/AdminSuppliersController.php index 09026fd5e..3f1438959 100644 --- a/controllers/admin/AdminSuppliersController.php +++ b/controllers/admin/AdminSuppliersController.php @@ -308,7 +308,7 @@ class AdminSuppliersControllerCore extends AdminController 'supplier' => $this->object, 'products' => $products, 'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'), - 'shopContext' => Context::getContext()->shop(), + 'shopContext' => Shop::getContext(), ); return parent::renderView();