开发者

change filter name in Magento from 'category' to the name of the parent category

开发者 https://www.devze.com 2023-03-26 02:46 出处:网络
On a layered category view the list of sub-categories is titled \'Category\' (as seen here: http://demo.magentocommerce.com/bed-and-bath), I would like it to instead be t开发者_Go百科itled with the na

On a layered category view the list of sub-categories is titled 'Category' (as seen here: http://demo.magentocommerce.com/bed-and-bath), I would like it to instead be t开发者_Go百科itled with the name of the parent category (if it has a parent, other than the root category).

So in the example at the above link, rather than being:

CATEGORY
-- Living Room
-- Bedroom

it would be:

FURNITURE
-- Living Room
-- Bedroom

My main issue seems to be figuring out how to access the category model from within the Mage_Catalog_Block_Layer_View as $this->getCurrentCategory() doesn't seem to work.

Using Magento ver. 1.5.1.0

Thanks!


The current category is stored in the Magento registry under the key current_category. You can access this value by calling:

$current_category = Mage::registry('current_category');

For completeness, you can set values in the registry using Mage::register('mykey', $myvalue).

The templates of interest to (I think) are under template/catalog/layer. Don't quote me though. You should switch on template hints to double check.

0

精彩评论

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

关注公众号