Session Magento-注册表和当前类别

Session Magento-注册表和当前类别,session,magento,magento-1.4,magento-1.5,Session,Magento,Magento 1.4,Magento 1.5,我有一个关于Mage::registry和categories的问题:我在一个category页面上,我通过Mage::registry'current_category'检索当前类别。我注意到它只适用于根类别,事实上,如果我访问子类别页面,我总是使用Mage::registry'current_category'检索根类别。因此,问题是:是关于后端配置、缓存还是其他内容?如果您在一个模板中,例如catalog/category/view.phtml,您可以使用 $this->getCur

我有一个关于Mage::registry和categories的问题:我在一个category页面上,我通过Mage::registry'current_category'检索当前类别。我注意到它只适用于根类别,事实上,如果我访问子类别页面,我总是使用Mage::registry'current_category'检索根类别。因此,问题是:是关于后端配置、缓存还是其他内容?

如果您在一个模板中,例如catalog/category/view.phtml,您可以使用

$this->getCurrentCategory();
如果您在模型、控制器或其他位置,请尝试以下方法:

但是,Mage::registry'current_category'是正常的方式。

OOB,当前_category是在Mage_category CategoryController::\u initCategory ref中设置的,并且始终等于当前正在查看的类别

如果您的数据不同,则您的应用程序具有非标准功能,或者您看到的是缓存结果

对于所有类别:-

<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
对于当前类别

<?php $currentCategory = Mage::registry('current_category') ?>

对我有用。

阅读你的帖子,然后问:你的问题是什么?你的参考链接已经死了。OOB是什么意思?
<?php $currentCategory = Mage::registry('current_category') ?>