Sunday, May 5, 2013

Magento - Display Specific Massage when free shipping available

One of the easiest way for display specific message , when free shipping available is create static block and display it.

Create new static block
CMS -> Static Block -> Add new.

then edit relevant template file "\app\design\frontend\PACKAGE-NAME\THEAME-NAME\template\checkout\onepage\shipping_method\available.phtml"

on top of that file update as follow


    <?php
// Remove any other shipping methods if free shipping is available
    $isFreeShippingAllow = false;
if ( array_key_exists('freeshipping', $_shippingRateGroups )) {
    $_shippingRateGroups = array('freeshipping' => $_shippingRateGroups['freeshipping']);
    $isFreeShippingAllow = true;
}
?>

Finally Call predefined static block when free shipping available



<?php
    if($isFreeShippingAllow){
      echo $this->getLayout()->createBlock('cms/block')->setBlockId('Solar_Free_Shipping_Msg')->toHtml();
   }
    ?>


;) one of the simple trick  :)





No comments:

Post a Comment