dasilva Posted January 6, 2014 Share Posted January 6, 2014 (edited) 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 January 7, 2014 by dasilva (see edit history) Link to comment Share on other sites More sharing options...
dasilva Posted January 6, 2014 Author Share Posted January 6, 2014 Personne n'a une idée d'où cela pourrait venir ? Link to comment Share on other sites More sharing options...
Olivier CLEMENCE Posted January 7, 2014 Share Posted January 7, 2014 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 1 Link to comment Share on other sites More sharing options...
dasilva Posted January 7, 2014 Author Share Posted January 7, 2014 (edited) C'est parfait, cela fonctionne de nouveau ! Milles mercis. Edited January 7, 2014 by dasilva (see edit history) Link to comment Share on other sites More sharing options...
dasilva Posted January 7, 2014 Author Share Posted January 7, 2014 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 More sharing options...
Olivier CLEMENCE Posted January 7, 2014 Share Posted January 7, 2014 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 More sharing options...
dasilva Posted January 7, 2014 Author Share Posted January 7, 2014 Cela fonctionne, mais ce coup-ci lorsque j'applique une réduction, le prix barré ne s'affiche plus ! Link to comment Share on other sites More sharing options...
Olivier CLEMENCE Posted January 7, 2014 Share Posted January 7, 2014 Peux tu poster le code que tu as mis sur le forum ? Link to comment Share on other sites More sharing options...
dasilva Posted January 7, 2014 Author Share Posted January 7, 2014 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 More sharing options...
Olivier CLEMENCE Posted January 7, 2014 Share Posted January 7, 2014 {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 More sharing options...
dasilva Posted January 7, 2014 Author Share Posted January 7, 2014 D'accord, j'étudierai Smarty car j'en ai fort besoin. Ceci dit cela ne marche toujours pas, malgré le fait d'avoir placé {displayWtPrice p=$product.price_without_reduction} entre mon if et mon else Link to comment Share on other sites More sharing options...
Olivier CLEMENCE Posted January 7, 2014 Share Posted January 7, 2014 Tu dois obtenir un code dans ce genre. {if $priceDisplay && $product.price_without_reduction neq $product.price}{displayWtPrice p=$product.price_without_reduction}{else}....la suite de ton code Link to comment Share on other sites More sharing options...
dasilva Posted January 7, 2014 Author Share Posted January 7, 2014 Oui, mais cela ne fonctionne pas ! Je vois toujours le prix barré même sans réduction Link to comment Share on other sites More sharing options...
Olivier CLEMENCE Posted January 7, 2014 Share Posted January 7, 2014 Essai de supprimer le {else} ainsi que ce qui suit sauf le {/if} 1 Link to comment Share on other sites More sharing options...
dasilva Posted January 7, 2014 Author Share Posted January 7, 2014 J'ai déjà essayé, même résultat Link to comment Share on other sites More sharing options...
Olivier CLEMENCE Posted January 7, 2014 Share Posted January 7, 2014 Ah.. ben là désolé je vais pas pouvoir t'aiguiller plus. Il faudrait que tu fasse des tests pour voir si les conditions sont bien respectées en affichant les valeurs, etc... 1 Link to comment Share on other sites More sharing options...
dasilva Posted January 7, 2014 Author Share Posted January 7, 2014 Je te remercie déjà énormément pour l'aide que tu m'as apporté ! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now