Afficher à la fois le montant réduit et le pourcentage dans la page du panier
-
12-12-2019 - |
Question
http://www.customy.com/blog/show-product-discount-percent-in-magento/
Le montant réduit sera indiqué en pourcentage dans le lien ci-dessus.
Je dois afficher le pourcentage de remise ainsi que "COMBIEN DE PRIX ÉCONOMISÉ".
EN NOMBRE", comme ceci :
Vous sauvegardez:5 810,00 (18%)
quels changements je dois faire pour cela.
s'il vous plaît, aidez-moi à trouver une solution.
Merci d'avance
La solution
aller àapp/design/frontend/base/default/template/catalog/product/
et copie price.phtml
à app/design/frontend/Your_theme/default/template/catalog/product/
maintenant en price.phtml
trouver pour ce code
<?php endif; /* if ($_finalPrice == $_price): */ ?>
au dessus de ce code ajoutez le code suivant
<?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; ?>
Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange