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?
相关问题
- Data loss during sending via $_SESSION from one sc
- Chrome not keeping my _SESSION vars when coming fr
- Using a session with php and Java
- Zend Auth locked session
- How to set session lifetime as infinite
相关文章
- Page指令 的EnableSessionState="ReadOnly",怎么在web.confi
- How exactly do Firebase Analytics handle session d
- Symfony2: check whether session exists or not
- Magento, translate validation error messages
- When is destructor called in a WCF service
- how to check session variable existence in MVC bef
- SQLAlchemy - Is there a way to see what is current
- Spring java.lang.IllegalStateException: Cannot cre
For all categories:-
For Current Category
Works for me.
If you are in a template (e.g.
catalog/category/view.phtml
) you can get the current category withIf you are in a model, controller or else, try this (found here):
However,
Mage::registry('current_category')
is the normal way to go.OOB,
current_category
is set inMage_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.