// Fix display of breadcrumb (dont show categories disabled) + it's now impossible to browse categories outside of root category for shops

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8089 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-08-17 12:32:04 +00:00
parent cb3d802346
commit 7481712923
8 changed files with 67 additions and 63 deletions
+20 -2
View File
@@ -596,7 +596,7 @@ class CategoryCore extends ObjectModel
if (!$shop)
$shop = Context::getContext()->shop;
return new Category($context->shop->getCategory(), $id_lang);
return new Category($shop->getCategory(), $id_lang);
}
/**
@@ -986,12 +986,30 @@ class CategoryCore extends ObjectModel
*/
public static function getInterval($id)
{
$sql = 'SELECT nleft, nright FROM '._DB_PREFIX_.'category
$sql = 'SELECT nleft, nright, level_depth
FROM '._DB_PREFIX_.'category
WHERE id_category = '.(int)$id;
if (!$result = Db::getInstance()->getRow($sql))
return false;
return $result;
}
/**
* Check if current category is a child of shop root category
*
* @since 1.5.0
* @param Shop $shop
* @return bool
*/
public function inShop(Shop $shop = null)
{
if (!$shop)
$shop = Context::getContext()->shop;
if (!$interval = Category::getInterval($shop->getCategory()))
return false;
return ($this->nleft >= $interval['nleft'] && $this->nright <= $interval['nright']);
}
public function getChildrenWs()
{