Jump to content

Bug incroyable sur mes prix...


Recommended Posts

Bonjour à tous,

 

Je vous sollicite car j'ai un soucis depuis que j'ai passé mes tarifs TTC en HT sur mon site.

Lorsque j'applique une réduction, le prix barré est inférieur au nouveau prix...

 

Voici le bout de code correspondant à l'affichage du prix barré :

 <div class="price_reduction_product">

{if $product.price_without_reduction neq $product.price}

<span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$product.price_without_reduction}{else}{displayWtPrice p=((($product.price_without_reduction) / (1 + ((($product.rate|intval) / 100)|floatval)))|floatval)}{/if}</span>

 {if $product.specific_prices}{assign var='pro_specific_prices' value=$product.specific_prices}

{if $pro_specific_prices.reduction_type eq 'percentage' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))}

{/if} {/if} {/if}

</div>

Avez-vous une idée d'où cela peut venir ?

 

Merci beaucoup d'avance !
Edited by dasilva (see edit history)
Link to comment
Share on other sites

Bonjour,

<span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$product.price_without_reduction}{else}{displayWtPrice p=((($product.price_without_reduction) / (1 + ((($product.rate|intval) / 100)|floatval)))|floatval)}{/if}</span>

Apparemment si l'affichage du prix est activé dans la boutique tu affiche le Else de ton If actuel soit le calcul suivant:

((($product.price_without_reduction) / (1 + ((($product.rate|intval) / 100)|floatval)))|floatval)}

ça me paraît bizar d'autant que la valeur que tu attends est sans doute celle de $product.price_without_reduction sans aucun calcul.

 

Essai d'enlever le ! devant le premier $price_display 

  • Like 1
Link to comment
Share on other sites

 Il me reste qu'un petit bug : mon prix barré s'affiche tout le temps, même quand je n'applique aucune réduction.Avez-vous une idée ?

<span class="price-discount">{if $priceDisplay}{displayWtPrice p=$product.price_without_reduction}{else}{displayWtPrice p=((($product.price_without_reduction) / (1 + ((($product.rate|intval) / 100)|floatval)))|floatval)}{/if}</span>
Link to comment
Share on other sites

C'est normal car le {if $priceDisplay} signifie "si l'affichage du prix est activé" donc le prix barré s'affichera toujours.

 

Il faut combiner ça avec la condition suivante:

$product.price_without_reduction neq $product.price

 

Ce qui donne un truc du genre:

{if $priceDisplay && $product.price_without_reduction neq $product.price}

Link to comment
Share on other sites

Pas de soucis :

<div class="price_reduction_product">

{if $product.price_without_reduction neq $product.price}

<span class="price-discount">{if $priceDisplay && $product.price_without_reduction neq $product.price}{else}{displayWtPrice p=((($product.price_without_reduction) / (1 + ((($product.rate|intval) / 100)|floatval)))|floatval)}{/if}</span>

 {if $product.specific_prices}{assign var='pro_specific_prices' value=$product.specific_prices}

{if $pro_specific_prices.reduction_type eq 'percentage' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))}

{/if} {/if} {/if}

</div>
Link to comment
Share on other sites

{if $priceDisplay && $product.price_without_reduction neq $product.price}{else}

Ben là tu as un if correcte (a priori) mais tu lui demande de ne rien afficher.

Tu dois avoir {displayWtPrice p=$product.price_without_reduction} Entre ton if et ton else.

 

Il faut que tu étudie un petit peu smarty pour mieux comprendre ce que tu fais: http://www.smarty.net/docsv2/fr/language.function.if.tpl

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...