http://www.customy.com/blog/show-product-discount-percent-in-magento/

减少的金额将在上面的链接中以百分比显示。

我需要显示折扣的百分比以及"节省了多少价格

在数量上",就像这样 :

您保存:5,810.00 (18%)

amazon.com

我必须为此做些什么改变。

请帮我找到解决方案。

提前致谢

有帮助吗?

解决方案

后藤 app/design/frontend/base/default/template/catalog/product/ 和复制 price.phtmlapp/design/frontend/Your_theme/default/template/catalog/product/ 现在在 price.phtml 查找此代码

<?php endif; /* if ($_finalPrice == $_price): */ ?>

在此代码上方添加以下代码

<?php if($_finalPrice < $_price): ?>
    <?php 
    $_savePercent = 100 - round(($_finalPrice / $_price) * 100); 
    $_saveAmount = number_format(($_price - $_finalPrice), 2);  
    ?>
        <p class="yousave">
            <span class="price-label label">You Save: </span>
            <span class="price">
                <strong class="save-amount">$<?php echo $_saveAmount; ?></strong> (<?php echo $_savePercent; ?>%)
            </span>
        </p>
    <?php endif; ?>
许可以下: CC-BY-SA归因
scroll top