0

我在 Magento 中添加了优惠券折扣。

但是添加代码的块没有出现在结帐或产品页面上。

我试过安装这个扩展http://www.magentocommerce.com/magento-connect/discount-coupon-code-checkout-page.html但它没有效果。

我是否需要更改 XML 或 PHP 以呈现折扣块?

4

2 回答 2

1

它默认出现,但如果你没有它,你的主题可能正在删除它的定义。在主题的布局文件夹中创建一个 local.xml 并具有以下内容:

<checkout_cart_index>
    <reference name="checkout.cart">
        <block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
    </reference>
</checkout_cart_index>

您可以编辑 cart.phtml 以修改页面中的位置。如果您没有看到:

            <?php echo $this->getChildHtml('coupon') ?>

您已经可以在第一步之前尝试编写它。

于 2014-08-01T12:30:46.887 回答
0

在我的情况下,购物车总计表中没有出现折扣我所做的是:在文件中:/app/design/frontend/base/default/template/checkout/cart/totals.phtml 我在 renderTotals 之前添加了下面的代码()

         $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); //Total object
                    if(isset($totals['discount']) && $totals['discount']->getValue()) {
                     $discount = Mage::helper('core')->currency($totals['discount']->getValue()); //Discount value if applied
                    } else {
                     $discount = '';
                    }
                    if($discount!=''){
                ?>
                <tr><td class="a-right"><strong>Discount (Festive5):</strong></td><td class="a-right"><?php echo $discount;?></td></tr>
                <?php } ?>
                <?php echo $this->renderTotals();?>

它将显示折扣券代码值。

于 2014-10-20T09:13:27.723 回答