我想在minicart上显示magento 1.9的折扣和税额,但是以下代码显示为0数字
<div class="subtotal">
<?php if ($canApplyMsrp): ?>
<span class="map-cart-sidebar-total"><?php echo $this->__('ORDER TOTAL WILL BE DISPLAYED BEFORE YOU SUBMIT THE ORDER'); ?></span>
<?php else: ?>
<span class="label"><?php echo $this->__('Cart Discount:') ?></span> <?php echo Mage::helper('checkout')->formatPrice($this->getDiscountAmount()) ?>
<?php if ($_subtotalInclTax = $this->getSubtotalInclTax()): ?>
<br />
<span class="incl-tax">(<?php echo Mage::helper('checkout')->formatPrice($_subtotalInclTax) ?> <?php echo Mage::helper('tax')->getIncExcText(true) ?>)</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="subtotal">
<?php if ($canApplyMsrp): ?>
<span class="map-cart-sidebar-total"><?php echo $this->__('ORDER TOTAL WILL BE DISPLAYED BEFORE YOU SUBMIT THE ORDER'); ?></span>
<?php else: ?>
<span class="label"><?php echo $this->__('Cart Tax:') ?></span> <?php echo Mage::helper('checkout')->formatPrice($this->getTaxAmount()) ?>
<?php if ($_subtotalInclTax = $this->getSubtotalInclTax()): ?>
<br />
<span class="incl-tax">(<?php echo Mage::helper('checkout')->formatPrice($_subtotalInclTax) ?> <?php echo Mage::helper('tax')->getIncExcText(true) ?>)</span>
<?php endif; ?>
<?php endif; ?>
</div>
答案 0 :(得分:0)
minicart
块是类Mage_Checkout_Block_Cart_Sidebar
的实例,它没有定义方法getDiscountAmount
或getTaxAmount
。
您可以使用$this->getQuote()->getShippingAddress()->getTaxAmount()
和$this->getQuote()->getShippingAddress()->getDiscountAmount()