// Fix shop context call

This commit is contained in:
rMalie
2012-02-24 08:51:52 +00:00
parent 4200ad049f
commit 683ab16d3c
4 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -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 .= '
@@ -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);
@@ -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();
@@ -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();