Bonjour à tous,

Actuellement sur ma version de prestashop, j'ai le prix d'origine qui s'affiche, le brix barré, la mention soldes au dessus en texte.

Je voudrais affiché une vignette dans un coin de l'image de mon produit, en fonction du pourcentage de réduction..

Donc par exemple si :

réduction supp à 41% => vignette 50%
si entre 31 et 40 = vignette 40%
si inférieur à 31 = vignette 30%

Mon but étant toujours de faires des soldes avec -30 -40 et -50 jamais autre chose.

Sachant que actuellement donc mon code, j'ai une fonction qui affiche déjà une vignette différente en fonction du taux de remise mais je ne vois pas comment l'adapté pour moi, je vous mets le code, en espérant que vous pourriez m'aider.


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{foreach from=$products item=product name=homeFeaturedProducts}
   {assign var='productLink' value=$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)}
   {if $product.price_without_reduction != $product.price}
    {math equation='1-(x/y)' x=$product.price y=$product.price_without_reduction assign='txreduc'}
   {else}
    {assign var='txreduc' value=0}
   {/if}
   <li class="ajax_block_product {if $smarty.foreach.homeFeaturedProducts.first}first_item{elseif $smarty.foreach.homeFeaturedProducts.last}last_item{else}item{/if} {if $smarty.foreach.homeFeaturedProducts.iteration%$nbItemsPerLine == 0}last_item_of_line{elseif $smarty.foreach.homeFeaturedProducts.iteration%$nbItemsPerLine == 1}first_item_of_line{/if} {if $smarty.foreach.homeFeaturedProducts.iteration > ($smarty.foreach.homeFeaturedProducts.total - ($smarty.foreach.homeFeaturedProducts.total % $nbItemsPerLine))}last_line{/if}">
    <a href="{$productLink}" title="{$product.legend|escape:htmlall:'UTF-8'}" class="product_image"><img src="{$img_prod_dir}{$product.id_image}-home.jpg" alt="{$product.legend|escape:htmlall:'UTF-8'}" height="129" width="129" />
    {if $txreduc>0.01}
         {if $txreduc>=$percent_asaisir}
    <div class="imgasaisir"><img src="{$img_dir}asaisir.png" alt="{l s='A saisir'}" /></div>
         {else}
    <div class="imgpromo"><img src="{$img_dir}promo.png" alt="{l s='Promotion'}" /></div>
         {/if}
    {/if}
Merci pour votre aide !