2

In my view.phtml i have called the estimate shipping price by this:

<?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>

But when I clicked to get a Quote for shipping nothing works and the price for shipping is not showing .Can anyone help me please. IF I am doing any wrong or something is not enable in backend

1
<!-- SHOW SHIPPING RATES-->
        <?php $quote = Mage::getModel('sales/quote');
        $quote->getShippingAddress()->setCountryId('ES'); // Set your default shipping country here
        $_product->getStockItem()->setUseConfigManageStock(false);
        $_product->getStockItem()->setManageStock(false);
        $quote->addProduct($_product);
        $quote->getShippingAddress()->setCollectShippingRates(true);
        $quote->getShippingAddress()->collectTotals();
        $rates = $quote->getShippingAddress()->getShippingRatesCollection();
        // Find cheapest rate
        $cheapestrate = null;
        foreach ($rates as $rate) {
            if (is_null($cheapestrate) || $rate->getPrice() < $cheapestrate) {
                $cheapestrate = $rate->getPrice();
            }
        }
        $corehelper = Mage::helper('core');
        if ($cheapestrate) {
            echo '<p><strong>Shipping costs:</strong> ' . $corehelper->currency($cheapestrate);?></p>
            <?php
            }else {
            echo "<strong>Free shipping</strong> for this product." ;
        }?>
        <!-- END SHOW SHIPPING RATES-->

This only works for Simple products

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.