Jump to content

Etat du produit : new, used, refurbished


Recommended Posts

Bonjour à tous,

Je souhaite ajouter un élément dans ma fiche produit entre le bloc :

{block name='page_header'} et le {block name='product_details_info'}

 

L'idée est d'afficher l'info :

"Remise 60%" si l'état du produit est "new",

"Remise 70%" si l'état du produit est "used",

et "Remise 80%" si l'état du produit est "refurbished".

 

Je travaille directement dans le fichier "product.tpl" accessible ici dans mon thème enfant : \templates\catalog\product.tpl

Voilà ce que j'aimerai ajouter mais il semblerait qu'il y a de grosses erreurs dans le code car j'ai une belle page blanche :

            {block name='product_condition'}
            {if $product.condition}
              <div class="product-condition">
                <label class="label">{l s='Condition' d='Shop.Theme.Catalog'} </label>
                {if $product.condition == 'new'}
                <link itemprop="itemCondition" href="{$product.condition.schema_url}"/>
                <span>{l s='discount : 60%' d='Shop.Theme.Catalog'}</span>
                {elseif $product.condition == 'used'}
                <link itemprop="itemCondition" href="{$product.condition.schema_url}"/>
                <span>{l s='discount : 70%' d='Shop.Theme.Catalog'}</span>
                {elseif $product.condition == 'refurbished'}
                <link itemprop="itemCondition" href="{$product.condition.schema_url}"/>
                <span>{l s='discount : 80%' d='Shop.Theme.Catalog'}</span>
              </div>
            {/if}
          {/block}

Pourriez-vous m'aider ?

Un grand merci par avance.

 

Link to comment
Share on other sites

Bonjour,

et comme cela ?

{block name='product_condition'}
    {if $product.condition}
      <div class="product-condition">
        <label class="label">{l s='Condition' d='Shop.Theme.Catalog'} </label>
        <link itemprop="itemCondition" href="{$product.condition.schema_url}"/>
        {if $product.condition.type == 'new'}
            <span>{l s='discount : 60%' d='Shop.Theme.Catalog'}</span>
        {elseif $product.condition.type == 'used'}
            <span>{l s='discount : 70%' d='Shop.Theme.Catalog'}</span>
        {elseif $product.condition.type == 'refurbished'}
            <span>{l s='discount : 80%' d='Shop.Theme.Catalog'}</span>
        {/if}
        
      </div>
    {/if}
{/block}

 

  • Thanks 1
Link to comment
Share on other sites

  • 3 years later...
On 3/8/2019 at 6:07 PM, Mediacom87 said:

Bonjour,

et comme cela ?

{block name='product_condition'}
    {if $product.condition}
      <div class="product-condition">
        <label class="label">{l s='Condition' d='Shop.Theme.Catalog'} </label>
        <link itemprop="itemCondition" href="{$product.condition.schema_url}"/>
        {if $product.condition.type == 'new'}
            <span>{l s='discount : 60%' d='Shop.Theme.Catalog'}</span>
        {elseif $product.condition.type == 'used'}
            <span>{l s='discount : 70%' d='Shop.Theme.Catalog'}</span>
        {elseif $product.condition.type == 'refurbished'}
            <span>{l s='discount : 80%' d='Shop.Theme.Catalog'}</span>
        {/if}
        
      </div>
    {/if}
{/block}

 

Oh ! tu es un dieu! Merci à toi

Link to comment
Share on other sites

  • 4 months later...

Je relance ce sujet avec un problème similaire.

Dans prestashop 1.7.6, je cherche à conditionner l'affichage d'un bouton par l'état 'used' ou non d'un produit.

J'ai tenté de faire le tri par catégories, mais je ne peux le faire que sur la catégorie par défaut, ce qui ne me convient pas. Je cherche désormais à le faire par cet état 'used' mais ça ne fonctionne pas :

Fichier product-add-to-cart.tpl

{if $product.condition.type == 'used'}<div class="col col-12 col-sm-auto col-add-btn "><div style="background-color:#c6c6c6; margin-left:10px;padding:15px;"><a href="/content/41-nouvelle-offre-de-prix">Faire une offre</a></div></div>{/if}

Quelqu'un aurait-il une idée pour sauver les quelques cheveux qu'il me reste ?

Par avance merci

Serge

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