开发者

Magento get the root category url

开发者 https://www.devze.com 2023-04-05 12:05 出处:网络
I\'m a Magento newbie. I\'ve customized the top navigation bar and now is something like this: HOMECATALOGCMS_LINKCMS_LINKCMS_LINK

I'm a Magento newbie.

I've customized the top navigation bar and now is something like this:

HOME   CATALOG   CMS_LINK   CMS_LINK   CMS_LINK

For the HOME link and the CMS_LINK links all it's ok but I would when an user click on 开发者_运维问答the CATALOG will see a page with all categories (subcategories of the root category) in a grid view with category i


As part of the category controller action Magento validates the category against the Mage_Catalog_Helper_Category function canShow().

This will return false against the check against isInRootCategoryList(). This function goes and checks the category's parent ids against the store root category id:

$rootCategoryId = Mage::app()->getStore()->getRootCategoryId();
return in_array($rootCategoryId, $category->getParentIds());

The easiest solution that I can think of for your problem without changing core functionality would be to create a sub category of your root category named "Catalog" which would itself contain all the other categories. You can then set-up this category to not display products and only display a cms block.

0

精彩评论

暂无评论...
验证码 换一张
取 消