// little fix

This commit is contained in:
vChabot
2012-01-20 10:35:17 +00:00
parent 88c2cd7b2d
commit 3fc6027754
+6 -5
View File
@@ -676,7 +676,7 @@ class CategoryCore extends ObjectModel
$is_more_than_one_root_category = count(Category::getCategoriesWithoutParent()) > 1; $is_more_than_one_root_category = count(Category::getCategoriesWithoutParent()) > 1;
if ((!Shop::isFeatureActive() && $is_more_than_one_root_category) || if ((!Shop::isFeatureActive() && $is_more_than_one_root_category) ||
Shop::isFeatureActive() && $is_more_than_one_root_category && $context->shop() != Shop::CONTEXT_SHOP) Shop::isFeatureActive() && $is_more_than_one_root_category && $context->shop() != Shop::CONTEXT_SHOP)
$category = Category::getTopCategory(); $category = Category::getTopCategory($id_lang);
else else
$category = new Category($shop->getCategory(), $id_lang); $category = new Category($shop->getCategory(), $id_lang);
@@ -1330,13 +1330,14 @@ class CategoryCore extends ObjectModel
WHERE `id_category` = '.(int)$this->id); WHERE `id_category` = '.(int)$this->id);
} }
public static function getTopCategory() public static function getTopCategory($id_lang = null)
{ {
if (is_null($id_lang))
$id_lang = Context::getContext()->language->id;
$id_category = Db::getInstance()->getValue(' $id_category = Db::getInstance()->getValue('
SELECT `id_category` SELECT `id_category`
FROM `'._DB_PREFIX_.'category` FROM `'._DB_PREFIX_.'category`
WHERE `id_parent` = 0 WHERE `id_parent` = 0');
'); return new Category($id_category, $id_lang);
return new Category($id_category);
} }
} }