Thursday 8 January 2015

Magento: Back Button On Product Detail Page

"/app/design/frontend/default/default/template/catalog/product/view.phtml"
path for view.phtml can be diffrent for diffrent magento themes.

and put this code


<?php if ($_category = $_product->getCategory()): ?>

<div class="back-button">
    <button onclick="history.back();" class="button" title="<?php echo $this->__('Back') ?>" type="button">
        <span>
            <span>
<?php echo $this->__('Back') ?></span>
        </span>
    </button>
</div>
<?php endif; ?>

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>

Wednesday 7 January 2015

Magento: Home Page condition

<?  $action = Mage::app()->getFrontController()->getAction()->getFullActionName();

if($action=='cms_index_index'){

    echo "Here Your custom code";

?>

 

<!-- or here you can write your custom code -->

    <?php echo $this->getChildHtml('breadcrumbs')  ?>

<?php  }  ?>