问题
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