For people using the Magento ecommerce framework (v.1.6.1 used in this example) you have seen that once you go to view your shopping cart and hit the continue shopping button, it takes you back to the last product you viewed, and not the last category, as would be logical.
To fix this issue find the file :
If you have a theme installed, you should look here first:
app/design/frontend/default/YOUR THEME NAME/template/checkout/cart.phtml
Now that you have the file you need, look for this code that starts the loop for every item in the cart(line 109 on my version):
<?php foreach($this->getItems() as $_item): ?>
Below that input the following code that will change the path of the continue shopping button by setting the product url to the category url inside the loop:
$_categories = $_item->getProduct()->getCategoryIds();
$_category = Mage::getModel(‘catalog/category’)->load($_categories);
$url = $this->getUrl($_category->getUrlPath());
If you have multiple products it will always set the url to the last product.
If you have need for a website designer, call us today 509-475-1177