Category Id coming same all the time in different category page magento 1.9

扶醉桌前 提交于 2019-12-25 00:01:47

问题


Hello I know this is simple question but I don't get any solution in here. So I am going to ask.

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.

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();

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.


回答1:


Try this

Mage::getModel('catalog/layer')->getCurrentCategory()->getId();


来源:https://stackoverflow.com/questions/49001436/category-id-coming-same-all-the-time-in-different-category-page-magento-1-9

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!