Greetings! I'm Aneesh Sreedharan, CEO of 2Hats Logic Solutions. At 2Hats Logic Solutions, we are dedicated to providing technical expertise and resolving your concerns in the world of technology. Our blog page serves as a resource where we share insights and experiences, offering valuable perspectives on your queries.
Here is a code snippet for setting the ‘Continue Shopping’ location to the category listing page of the last product added to the cart. Open the template/checkout/cart.phtml file in your active theme. Place the following code in the foreach loop
(ie. after this line of code)
1 | < ?php foreach($this->getItems() as $_item): ?> |
that generates the products list in the cart.
1 2 3 4 5 6 7 | < ?php $_categories = $_item->getProduct()->getCategoryIds(); $_category = Mage::getModel(‘catalog/category’)->load($_categories[0]); $url = $this->getUrl($_category->getUrlPath()); Mage::getSingleton(‘checkout/session’)->setContinueShoppingUrl($url); ?> |
You are done!