2011-08-26 63 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