Jump to content

Promo: prix barré qui s'affiche et puis disparait.


Recommended Posts

Bonjour à tous,

 

Quand je créer un promo sur un article avec "Prix spécifiques", le nouveau prix est bien affiché mais pas l'ancien prix barré. Laisser le prix de base, est bien coché.
Quand j'actualise la page, le prix barré s'affiche pendant le chargement de la page puis disparait.
Avez-vous une idée du problème?

Prestashop 1.6.0.6.

Merci

 

Link to comment
Share on other sites

Après recherche avec FIREBUG, j'ai trouvé quand supprimant: " style="display: none;"   les prix barré apparaissaient de nouveau.

Ne connaissant rien en code, peut-ont supprimer cette ligne sans risque?

De plus, dans le dossier Product.tpl je ne trouve pas tout à fait les même lignes que dans firebug, je me trompe peut être de dossier?
Voici ce qu'il y a:

 

<p id="old_price"{if !$product->specificPrice || !$product->specificPrice.reduction} class="hidden"{/if}>

                       {if $priceDisplay >= 0 && $priceDisplay <= 2}

                <span id="old_price_display">{if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction}{/if}</span>

            <!--SP    {if $tax_enabled && $display_tax_label == 1}{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}{/if}-->

            {/if}

            </p>

            <p id="reduction_amount" {if !$product->specificPrice OR $product->specificPrice.reduction_type != 'amount' || $product->specificPrice.reduction|intval ==0} style="display:none"{/if}>

                <span id="reduction_amount_display">

                {if $product->specificPrice AND $product->specificPrice.reduction_type == 'amount' AND $product->specificPrice.reduction|intval !=0}

                    -{convertPrice price=$productPriceWithoutReduction-$productPrice|floatval}

                {/if}

                </span>

   
                      

Link to comment
Share on other sites

Bonjour Frédéric,

 

Quelle est ta version de Prestashop ? Et pourrais-tu indiquer une url qui pose souci.

 

Le prix barré ne s'affiche pas sur la fiche produit ou bien sur les pages de produits en liste (en gros, les pages où tu as la listes de tes produits) ?

 

Dans le 1er cas, c'est le fichier product.tpl qu'il faut modifier, dans le second, c'est le fichier product-list.tpl.

 

Concernant la différence d'affichage de code entre firebug et le fichier, c'est normal. Firebug va t'indiquer le code HTML, or les fichiers .tpl utilisent le langage smarty (jusqu'à la version 1.6 de prestashop, je crois que sur la version 1.7, il s'agit de Symfony). Donc en gros, avec Firebug tu as le code HTML généré via smarty mais pas le code smarty d'où la différence.

 

Mais honnêtement, je ne pense pas que ce soit un souci de display:none. Je vois que ton code a été modifié à ce niveau là :

   <!--SP    {if $tax_enabled && $display_tax_label == 1}{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}{/if}-->

Ce bout de code a été mis en commentaire avec  "SP" juste devant qui ne rime à rien.  Et puis par rapport au code que j'ai chez moi, il manque des choses et notamment :

{hook h="displayProductPriceBlock" product=$product type="old_price"}
Edited by Céline13240 (see edit history)
Link to comment
Share on other sites

Bonjour Céline,

 

Voici un exemple, le souci est uniquement sur la fiche produit pas dans la liste avec les vignettes ou le prix est bien affiché barré avec le prix d'origine.

http://www.futaine.com/literie-bebe-coton-bio/84-housse-de-couette-bebe-coton-bio-flanelle-ecruesatin-raye.html

 

Le code a surement été modifié avec le thème.

Prestashop 1.6.0.6.

Merci

Link to comment
Share on other sites

Re,

 

Oui, en effet, j'ai vu ça.

 

Du coup, s'il s'agit d'un thème que tu as acheté, il possède donc ses propres fichiers templates, le mieux est de prendre contact avec le développeur.

 

Mais en attendant sa réponse tu peux essayer de remettre le hook, c'est-à-dire après la ligne : 

{if $priceDisplay >= 0 && $priceDisplay <= 2}

tu ajoutes :

{hook h="displayProductPriceBlock" product=$product type="old_price"}

Et si veux retrouver facilement le code ajouté (en fonction du retour du développeur tu mets un commentaire à côté comme ceci :

{hook h="displayProductPriceBlock" product=$product type="old_price"} <!-- ton commentaire -->

et dans tous les cas, tu gardes précieusement une copie de ton fichier original.

 

Pour en revenir au display:none, en effet celui-ci s'affiche sous firebug mais je ne vois pas où il se situe dans ton code, à moins de retirer la class="hidden" mais je ne suis pas sûre du tout (moi aussi je l'ai dans mon code et mon prix barré s'affiche correctement).

 

Bon au cas où, je te mets le code que j'ai et qui permet l'affichage du prix barré sur ma fiche produit mais vu que tu utilises un thème d'un développeur, selon les modifications effectuées, cela peut ne pas fonctionner, donc à manipuler avec précaution. Et toujours conserver une copie du fichier original que tu modifies (je sais je me répète mais une erreur est si vite arrivée).

<p id="old_price"{if (!$product->specificPrice || !$product->specificPrice.reduction) && $group_reduction == 0} class="hidden"{/if}>{strip}
	{if $priceDisplay >= 0 && $priceDisplay <= 2}
	{hook h="displayProductPriceBlock" product=$product type="old_price"}
		<span id="old_price_display">{if $productPriceWithoutReduction > $productPrice}<span class="price">{convertPrice price=$productPriceWithoutReduction}</span>
                   {if $tax_enabled && $display_tax_label == 1} {if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}{/if}{/if}</span>
	{/if}
{/strip}</p>
		

Comme tu peux le voir, il n'y a guère de différence entre nos codes, si ce n'est l'absence du hook et la mise en commentaire de la ligne sur les taxes, c'est pourquoi, j'espère qu'en ajoutant la ligne de code du hook, cela fonctionne correctement.

 

Mais dans tous les cas, prend contact avec le développeur du Thème, il est le mieux placé pour t'aiguiller et je dirais même plus, il se doit de te corriger ce bug.

 

Cordialement,

 

Céline

Link to comment
Share on other sites

Bonjour Céline,

 

Je vais prendre contact avec le développeur du thème.

Ce qui est bizarre, c'est que sur la boutique de DEV sur laquelle je fais des tests, les prix fonctionnent correctement et je ne vois pas de différence dans les codes.
code boutique en production:

 

<div class="price product_page">

                <p class="our_price_display" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">

                {if $priceDisplay >= 0 && $priceDisplay <= 2}

                    <span id="our_price_display" itemprop="price">{convertPrice price=$productPrice}</span>

                    <!--{if $tax_enabled  && ((isset($display_tax_label) && $display_tax_label == 1) OR !isset($display_tax_label))}

                        {if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}

                    {/if}-->

                {/if}

                </p>

            <p id="old_price"{if !$product->specificPrice || !$product->specificPrice.reduction} class="hidden"{/if}>

            

            {if $priceDisplay >= 0 && $priceDisplay <= 2}

                <span id="old_price_display">{if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction}{/if}</span>

            <!--SP    {if $tax_enabled && $display_tax_label == 1}{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}{/if}-->

            {/if}

            </p>

            <p id="reduction_amount" {if !$product->specificPrice OR $product->specificPrice.reduction_type != 'amount' || $product->specificPrice.reduction|intval ==0} style="display:none"{/if}>

                <span id="reduction_amount_display">

                {if $product->specificPrice AND $product->specificPrice.reduction_type == 'amount' AND $product->specificPrice.reduction|intval !=0}

                    -{convertPrice price=$productPriceWithoutReduction-$productPrice|floatval}

                {/if}

                </span>

            </p>

            <p id="reduction_percent" {if !$product->specificPrice OR $product->specificPrice.reduction_type != 'percentage'} style="display:none;"{/if}><span id="reduction_percent_display">{if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage'}-{$product->specificPrice.reduction*100}%{/if}</span></p>

            

                <div class="price_redukcja">

                {if $product->on_sale}

                    <span class="on_sale">{l s='On sale!'}</span>

                {elseif $product->specificPrice AND $product->specificPrice.reduction AND $productPriceWithoutReduction > $productPrice}

                    <span class="discount">{l s='Reduced price!'}</span>

                {/if}

                {if $priceDisplay == 2}

                    <br />

                    <span id="pretaxe_price"><span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span> {l s='tax excl.'}</span>

                {/if}

                

            {if $packItems|@count && $productPrice < $product->getNoPackPrice()}

                <p class="pack_price">{l s='Instead of'} <span style="text-decoration: line-through;">{convertPrice price=$product->getNoPackPrice()}</span></p>

            {/if}

            {if $product->ecotax != 0}

                <p class="price-ecotax">{l s='Include'} <span id="ecotax_price_display">{if $priceDisplay == 2}{$ecotax_tax_exc|convertAndFormatPrice}{else}{$ecotax_tax_inc|convertAndFormatPrice}{/if}</span> {l s='For green tax'}

                    {if $product->specificPrice AND $product->specificPrice.reduction}

                    <br />{l s='(not impacted by the discount)'}

                    {/if}

                </p>

            {/if}

            {if !empty($product->unity) && $product->unit_price_ratio > 0.000000}

                 {math equation="pprice / punit_price"  pprice=$productPrice  punit_price=$product->unit_price_ratio assign=unit_price}

                <p class="unit-price"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per'} {$product->unity|escape:'htmlall':'UTF-8'}</p>

            {/if}

            {*close if for show price*}

            </div>

            </div>

 

 

Code boutique de DEV:

 

 

<div class="price product_page">

                <p class="our_price_display" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">

                {if $priceDisplay >= 0 && $priceDisplay <= 2}

                    <span id="our_price_display" itemprop="price">{convertPrice price=$productPrice}</span>

                    <!--{if $tax_enabled  && ((isset($display_tax_label) && $display_tax_label == 1) OR !isset($display_tax_label))}

                        {if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}

                    {/if}-->

                {/if}

                </p>

            <p id="old_price"{if !$product->specificPrice || !$product->specificPrice.reduction} class="hidden"{/if}>

            

            {if $priceDisplay >= 0 && $priceDisplay <= 2}

                <span id="old_price_display">{if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction}{/if}</span>

            <!--SP    {if $tax_enabled && $display_tax_label == 1}{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}{/if}-->

            {/if}

            </p>

            <p id="reduction_amount" {if !$product->specificPrice OR $product->specificPrice.reduction_type != 'amount' || $product->specificPrice.reduction|intval ==0} style="display:none"{/if}>

                <span id="reduction_amount_display">

                {if $product->specificPrice AND $product->specificPrice.reduction_type == 'amount' AND $product->specificPrice.reduction|intval !=0}

                    -{convertPrice price=$productPriceWithoutReduction-$productPrice|floatval}

                {/if}

                </span>

            </p>

            <p id="reduction_percent" {if !$product->specificPrice OR $product->specificPrice.reduction_type != 'percentage'} style="display:none;"{/if}><span id="reduction_percent_display">{if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage'}-{$product->specificPrice.reduction*100}%{/if}</span></p>

            

                <div class="price_redukcja">

                {if $product->on_sale}

                    <span class="on_sale">{l s='On sale!'}</span>

                {elseif $product->specificPrice AND $product->specificPrice.reduction AND $productPriceWithoutReduction > $productPrice}

                    <span class="discount">{l s='Reduced price!'}</span>

                {/if}

                {if $priceDisplay == 2}

                    <br />

                    <span id="pretaxe_price"><span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span> {l s='tax excl.'}</span>

                {/if}

                

            {if $packItems|@count && $productPrice < $product->getNoPackPrice()}

                <p class="pack_price">{l s='Instead of'} <span style="text-decoration: line-through;">{convertPrice price=$product->getNoPackPrice()}</span></p>

            {/if}

            {if $product->ecotax != 0}

                <p class="price-ecotax">{l s='Include'} <span id="ecotax_price_display">{if $priceDisplay == 2}{$ecotax_tax_exc|convertAndFormatPrice}{else}{$ecotax_tax_inc|convertAndFormatPrice}{/if}</span> {l s='For green tax'}

                    {if $product->specificPrice AND $product->specificPrice.reduction}

                    <br />{l s='(not impacted by the discount)'}

                    {/if}

                </p>

            {/if}

            {if !empty($product->unity) && $product->unit_price_ratio > 0.000000}

                 {math equation="pprice / punit_price"  pprice=$productPrice  punit_price=$product->unit_price_ratio assign=unit_price}

                <p class="unit-price"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per'} {$product->unity|escape:'htmlall':'UTF-8'}</p>

            {/if}

            {*close if for show price*}

            </div>

            </div>

Edited by Frédéric09 (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

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