visit this link

search for "check" using CTRL + F, you can see :

enter image description here

enter "560043" as zip code & click on "check" button , you can see :

"RS 50 " , this is shipping charge. Instead of displaying "Rs 50 " here,

I want to display above "ADD TO CART" button as Selling Price + Rs 50 Delivery

It should prefix with "Selling Price +" & suffix with "Delivery" as link2

we are using following code for display shipping charges.


so what i did is I placed complete code in view.phtml file. but now we are getting only error message when we click on " check" button, its not calculating shipping charges.


<?php if ($this->getResult()):?>
            <?php foreach ($this->getResult() as $code => $_rates): ?>
                <dt><?php echo $this->getCarrierName($code) ?></dt>
                    <?php foreach ($_rates as $_rate): ?>
                        <li<?php if ($_rate->getErrorMessage()) echo ' class="error-msg"';?>>
                           <?php if ($_rate->getErrorMessage()): ?>
                                <?php echo $_rate->getErrorMessage() ?>
                           <?php else: ?>
                            //  echo $_rate->getMethodTitle() 
                                <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
                                <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
                                <?php echo $_excl; ?>
                                <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
                                    (<?php echo Mage::helper('webdevlopers_productpageshipping')->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
                                <?php endif; ?>
                           <?php endif ?>
                    <?php endforeach; ?>
            <?php endforeach; ?>
        <?php else: ?>
        <?php //echo $this->getMessagesBlock()->toHtml(); ?>
        <?php echo Mage::helper('webdevlopers_productpageshipping')->getResult(); ?>
<?php endif;?>

view.phtml : http://pastebin.com/EWnACrsT // 30000 charactars allowed.

  • Use this code above Your Add to cart code – Magento 2 Mar 23 '16 at 7:43
  • i will try calling this phtml code. – Baby in Magento Mar 23 '16 at 7:44
  • i used this code in static block: {{block type="core/template" name="charges" template="webdevlopers/productpageshipping/estimate/form.phtml"}} i am using this code : <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('charges')->toHtml(); ?> in view.phtml file but its not working. – Baby in Magento Mar 23 '16 at 7:57

My 2 cents: why don't you consider moving the HTML block via JavaScript?

It's easier, can be easily toggled and gives you more control without touching original templates.

Hope it helps.

  • can you please update the answer with code. – Baby in Magento Mar 23 '16 at 7:42
  • Sorry I'm not such a JavaScript expert. What's more it depends on which library you want to use (prototype, jquery). The idea is that of adding some code to the check callback to identify the desired block and move it through the DOM. – Alessandro Ronchi Mar 23 '16 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.