Copy following file
/app/code/core/core/Mage/Checkout/Block/Cart.php
and place under local codepool
app/code/core/local/Mage/Checkout/Block/Cart.php
Update the following code into function getContinueShoppingUrl()
public function getContinueShoppingUrl()
{
/*
$url = $this->getData('continue_shopping_url');
if (is_null($url)) {
$url = Mage::getSingleton('checkout/session')->getContinueShoppingUrl(true);
if (!$url) {
$url = Mage::getUrl();
}
$this->setData('continue_shopping_url', $url);
}
return $url;
*/
$lastProductAddedToCartId = Mage::getSingleton('checkout/session')->getLastAddedProductId();
if($lastProductAddedToCartId) {
$productCategoryIdsArray = Mage::getModel('catalog/product')->load($lastProductAddedToCartId)->getCategoryIds();
$continueShoppingCategoryUrl = Mage::getModel('catalog/category')->load($productCategoryIdsArray[0])->getUrl();
}
return $continueShoppingCategoryUrl;
}
Enjoy the work!!