在购物车页面中同时显示减少的金额和百分比
-
12-12-2019 - |
题
http://www.customy.com/blog/show-product-discount-percent-in-magento/
减少的金额将在上面的链接中以百分比显示。
我需要显示折扣的百分比以及"节省了多少价格
在数量上",就像这样 :
您保存:5,810.00 (18%)
我必须为此做些什么改变。
请帮我找到解决方案。
提前致谢
解决方案
后藤
app/design/frontend/base/default/template/catalog/product/
和复制 price.phtml
到 app/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; ?>