在不同类别页面magento 1.9中,类别ID一直都一样 [英] Category Id coming same all the time in different category page magento 1.9
问题描述
您好,我知道这是一个简单的问题,但是我在这里没有任何解决方案.所以我要问.
Hello I know this is simple question but I don't get any solution in here. So I am going to ask.
我正在使用magento 1.9,在类别页面中,左侧栏上有小部件,用于显示当前类别的所有产品.当我更改类别时,例如,如果我在saree的页面上,那么如果我转到着装页面,则在左侧边栏中将显示saree的产品的旧类别.
I am using magento 1.9, In category page I have widget on left sidebar to display current category's all product. When I change the category, for example if I am on saree's page then if I go to Dress page then in left sidebar the old category that is saree's product are displaying.
我认为类别ID来自不变的缓存,它保持不变.
I think category id is coming from cache that is not changing it is remain same.
我写以下行来获取当前类别.
I write following line to fetch the current category.
$_category = Mage::registry('current_category');
$catid = $_category->getId();
但是类别ID即将来临,这是我们第一次开放.
But the category id coming which we have open first time.
问.解决方法我已经搜索了类似的问题,但没有适当的答案.
Q. How to resolved I have search the similar question but I don't any appropriate answer.
推荐答案
尝试一下
Mage::getModel('catalog/layer')->getCurrentCategory()->getId();
这篇关于在不同类别页面magento 1.9中,类别ID一直都一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!