2011-08-26 54 views
0

在Magento平臺上建立一個網上商店(仍然是本地主機),並希望在我的頭部購物車中顯示出貨。getShippingIncludeTax - 正確的代碼方式

目前運費在主購物車中顯示爲正常,但在標題購物車中顯示爲無稅。

這是主要的車的代碼:(帶稅的權利一個包括)

<?php echo $this->helper('checkout')->formatPrice($this->getShippingIncludeTax()) ?> 

這是頭車的代碼:(不含稅顯示)

<?php echo Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingAmount(); ?> 

作爲你可以看到「getShippingIncludeTax」應該被添加,而不僅僅是金額。 任何想法如何一起實現這個代碼?

附加: 此代碼也適用於標題,但是沒有相同的稅額。

<?php $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); 
     if(isset($totals['shipping'])) 
     print __(number_format($totals['shipping']->getDat('value'),2)); ?> 

回答

0

會更好嗎?

<?php echo Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingIncTax(); ?> 

它實際上是比較容易看到什麼是您的對象中,你可以從它

<?php print_r(array_keys(Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getData()));?> 
+0

問什麼我不知道,如果這種情況已經改變,但在Magento的1.7,我不得不使用getShippingInclTax( )而不是getShippingIncTax()。 – gregdev