Monday, November 26, 2012

Magento getShippingRatesCollection Methods



Magento: Show all shipping options for the item in your cart.

Because sometimes you might need to do this:

$quote = Mage::getSingleton('checkout/cart')->getQuote();
$rates = $quote->getShippingAddress()->getShippingRatesCollection();

foreach ($rates as $rate)
{
echo "
Shipping Method: " . $rate->getMethod();
echo "
Shipping Method Title: " . $rate->getMethodTitle();
echo "
Shipping Method Description: " . $rate-> getMethodDescription();
echo "
Shipping Price: " . $rate->getPrice();
echo "
Carrier: " . $rate-> getCarrier();
echo "
Carrier Title: " . $rate-> getCarrierTitle();
}

No comments:

Post a Comment