Magento-注册表和当前类别 [英] Magento - registry and current category
问题描述
我对Mage::registry
和categories:
有疑问,我在类别页面上,我通过Mage::registry('current_category')
检索当前类别.我注意到它仅适用于根类别,实际上,如果我访问子类别页面,则总是使用Mage::registry('current_category')
检索根类别.所以问题是:关于后端配置,缓存还是其他?
I have a question about Mage::registry
and categories:
I'm a on a category page, I retrieve current category by Mage::registry('current_category')
. I've noticed that it works only for root categories, in fact if I visit a subcategory page I retrieve always the root category with Mage::registry('current_category')
. So the question is: is something about backend configuration, cache or something else?
推荐答案
OOB,current_category
在Mage_Catalog
CategoryController::_initCategory()
中设置(请参阅
OOB, current_category
is set in Mage_Catalog
CategoryController::_initCategory()
(ref here) and will always be equal to the category currently being viewed.
如果您的数据不同,则您的应用程序具有非标准功能,或者您看到的是缓存的结果.
If your data is different then your app has non-standard functionality or you are seeing cached results.
这篇关于Magento-注册表和当前类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!