在微型购物车Magento 1.9上显示折扣金额

时间:2018-10-15 01:46:49

标签: php

我想在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>

1 个答案:

答案 0 :(得分:0)

minicart块是类Mage_Checkout_Block_Cart_Sidebar的实例,它没有定义方法getDiscountAmountgetTaxAmount

您可以使用$this->getQuote()->getShippingAddress()->getTaxAmount()$this->getQuote()->getShippingAddress()->getDiscountAmount()