Reputation: 613
I have found this old piece of code, which seems to work just perfectly in Magento 1.6.2. My problem is, that it is not showing the value with Tax, and it's showing the value as ex. 60.0000
Would it somehow be possible to get it to show with tax and as a currency? Or maby just somehow (I've already tried this with no luck, no matter how I put together the if statement..) build an if statement so that if it's 60.000 then it will echo 75$ ?
$totals = Mage::getModel('checkout/session')->getQuote()->getTotals();
if(isset($totals['shipping']))
print $totals['shipping']->getData('value');
Upvotes: 1
Views: 5478
Reputation: 613
I made this crude solution, it's ugly, but it's working, if there's any suggestions to minimize this then please come with suggestions :) .
<?php $fragt = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingAmount();
if (($fragt >= 0) && ($fragt <= 60))
echo $this->__('Fragt: 75 DKK ');
else
if (($fragt >= 75) && ($fragt <= 78))
echo $this->__('Fragt: 95 DKK ');
else
if (($fragt >= 79) && ($fragt <= 99))
echo $this->__('Fragt: 100 DKK ');
else
if (($fragt >= 100) && ($fragt <= 110))
echo $this->__('Fragt: 120 DKK ');
else
if (($fragt >= 120) && ($fragt <= 151))
echo $this->__('Fragt: 150 DKK ');
else
if (($fragt >= 200) && ($fragt <= 301))
echo $this->__('Fragt: 300 DKK ');
?>
</span>
Upvotes: 0
Reputation: 17656
To get your cart total (assuming that the customer is log in or enter the shipping info)
$cart = Mage::getModel('checkout/session')->getQuote();
echo Mage::helper('core')->currency($cart->getGrandTotal(),true,false);
To get Shipping amount
$shippingMethod = $cart->getShippingAddress();
echo Mage::helper('core')->currency($shippingMethod['shipping_amount'],true,false);
Source http://www.magentocommerce.com/boards/viewthread/278544/
Upvotes: 3