Thursday 8 January 2015

Magento: “Continue Shopping” button redirect to the last product's category page

It is working fine.

<?php
    $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();
    }
?>
<button type="button" title="Continue Shopping" class="button" onclick="setLocation('<?php echo (isset($continueShoppingCategoryUrl)) ? $continueShoppingCategoryUrl : $this->getContinueShoppingUrl(); ?>')"><span><span>Continue Shopping</span></span></button>

3 comments:

  1. Really nice blog about "continue shopping button", pretty well maintained blog. Thanks for this blog and keep updating.
    buy Australian opal online

    ReplyDelete
  2. Its a very impressive post and pretty well maintained. This post has full of information. Thanks for the post and keep updating.
    mycophenolate tablet

    ReplyDelete