Jump to content

ContextErrorException Notice: A non well formed numeric value encountered


Recommended Posts

Bonjour,

J'ai un souci lorsque je mets en mode debug. Ce souci vient du fait que lorsque je mets une reduction sur un produit j'affiche cette réduction sur la miniature dans product-grid-view.tpl. Voici le code qui pose problème :

<div class="jhpproduct-image">
			<div class="jhpproduct-image-inner">
            {if $product.has_discount}
            {if $product.discount_type === 'percentage'}
              <span class="discount-percentage-grid-fond">
                  <span class="discount-percentage-grid-font">-{l s='%percentage%' d='Shop.Theme.Catalog' sprintf=['%percentage%' => $product.discount_percentage_absolute]}</span></span>
            {else}
                <span class="discount-percentage-grid-fond">
   {***** Cette ligne pose probleme *****} <span class="discount-percentage-grid-font">&Eacute;conomisez {($product.discount_amount_to_display/1.20)|string_format:"%d"|replace:"-":""|replace:".":","} €</span></span>
                  
                
            {/if}
            {/if}
  </div>
</div>

Je comprends l'erreur mais je ne vois pas  comment faire pour afficher le montant de la réduction sans le "-", avec une virgule au lieu d'un point et le signe €. 

Voici l'erreur : 

1694237666_Capturedecran2021-03-22a12_59_37.thumb.png.12a490eeebdf28e3c7a59f0add398f21.png

Merci de votre aide

 

Prestashop 1.7.5

Link to comment
Share on other sites

6 minutes ago, doekia said:

La division (/) n'existe pas en smarty, il faut passer par la fonction {math }

Merci. J'essaie ce code mais ca n'affiche aucun résultat :

{math equation = "x/y" x=$product.discount_amount_to_display y="1.20"|string_format:"%d"|replace:"-":""|replace:".":","}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...