Jump to content

[Résolu] Prix barré alors qu'il n'y a aucune remise sur l'article


Hobbes

Recommended Posts

Bonjour,

 

Mon deuxième réflexe serait de vérifier en fiche produit que les produits concernés n'ont pas été enregistrés en tant que "pack", ce qui provoque automatiquement ce type d'affichage (en fiche produit du moins sur ps original).

 

Cordialement. Daniel

Link to comment
Share on other sites

J'ai parcouru la table ps_specific_price mais les articles n'y sont pas. Et je n'ai aucun "pack" de paramétré.

 

Merci pour l'idée en tout cas. Une autre suggestion ? Je pensais peut-être à un problème d'arrondi.

Link to comment
Share on other sites

J'ai trouvé, il s'agissait bien d'un problème d'arrondi visiblement, ou en tout cas de la manière dont les arrondis sont gérés.

 

Dans mon product-list.tpl, j'ai remplacé

 

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

par

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

 

et je n'ai plus ces prix barrés quand ce n'est pas justifié.

Edited by bijsaubi (see edit history)
Link to comment
Share on other sites

Bon visiblement ce n'est pas suffisant malgré tout j'ai toujours certains articles avec des prix barrés. Par contre il doit y avoir un vrai souci dans la gestion des arrondis dans le product-list.tpl.

Si une âme charitable peut me conseiller une modif du fichier ?

 

 

{if isset($products)}
<!-- Products list -->
<ul id="product_list" class="clear">
{foreach from=$products item=product name=products}
 <li class="ajax_block_product {if $smarty.foreach.products.first}first_item{elseif $smarty.foreach.products.last}last_item{/if} {if $smarty.foreach.products.index % 2}alternate_item{else}item{/if} clearfix">
 {if isset($product.new) && $product.new == 1}
 <img src="http://www.bijouterie-saubi.fr/themes/prestashop_new/img/flag_new_bg.jpg" width=176 height=25 alt="Nouveau" align="left" style="position: absolute;margin-top: 45px;margin-left: -5px;">{/if}
  <div class="center_block">
  {if isset($product.new) && $product.new == 1}{*<span class="new">{l s='New'}</span>*}{/if}
   <h3><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">{$product.name|truncate:60:'...'|escape:'htmlall':'UTF-8'}</a></h3>
   <a href="{$product.link|escape:'htmlall':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} style="margin-top:25px;margin-bottom:10px" /></a>

   <p class="product_desc"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|truncate:460:'...'|strip_tags:'UTF-8'|escape:'htmlall':'UTF-8'}">{$product.description|truncate:150:'...'|strip_tags:'UTF-8'}</a></p>
  </div>					
  <div class="right_block">

  <div class="price_reduction">
{if $product.price_without_reduction > $product.price}
				    <span class="price-discount" style="text-decoration:line-through">
{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))}(-{$pro_specific_prices.reduction * 100|floatval}%)
																			 {/if}
																    {/if}
														    {/if}
</div>
{*  
*   <p id="old_price" style="text-decoration:line-through;color:red">
* {if $priceDisplay >= 0 && $priceDisplay <= 2}
* {if $product.price_without_reduction > $product.price}
* <span id="old_price_display">{convertPrice price=$product.price_without_reduction}</span>
* {if $tax_enabled}
* {if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
* {/if}
* {/if}
* {/if}
* </p>
*}  
   {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="on_sale">{l s='On sale!'}</span>
   {elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="discount">{l s='Reduced price!'}</span>{/if}
   {if isset($product.online_only) && $product.online_only}<span class="online_only">{l s='Online only!'}</span>{/if}
   {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
   <div>
 {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}<span class="price" style="display: inline;">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span><br />{/if}
{*	
*	 {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.allow_oosp || $product.quantity > 0)}{l s='Available'}</span>{else}<span class="notavailable">{l s='Out of Stock'}{/if}</span>{/if}
*}
   </div>
   {/if}

   {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && !$PS_CATALOG_MODE}
 {if ($product.allow_oosp || $product.quantity > 0) && $product.customizable != 2}
  <a class="button ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart.php')}?add&id_product={$product.id_product|intval}{if isset($static_token)}&token={$static_token}{/if}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
 {else}
   <span class="exclusive">{l s='Add to cart'}</span>
 {/if}
   {/if}
   <a class="button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>
   {if isset($comparator_max_item) && $comparator_max_item}
 <p class="compare"><input type="checkbox" onclick="checkForComparison({$comparator_max_item})" class="comparator" id="comparator_item_{$product.id_product}" value="{$product.id_product}" /> <label for="comparator_item_{$product.id_product}">{l s='Select to compare'}</label></p>
   {/if}   
  </div>
 </li>
{/foreach}
</ul>
<!-- /Products list -->
{/if}

Link to comment
Share on other sites

  • 4 weeks later...

J'utilise le thème alternatif 1.5 qui avait été mis à disposition par Prestashop sous la 1.4.

Evidemment que ce soit dans ce thème ou dans le thème par défaut, il n'y a pas d'affichage des prix barrés d'origine. C'est une modification qui a été faîte pour permettre l'affichage du prix barré lorsqu'il y a une réduction.

 

Mais je ne comprends pas pourquoi sur certains produits non remisés il affiche malgré tout un prix barré.

Link to comment
Share on other sites

J'ai fini par trouver.

Tout se passe dans le product-list.tpl :

 

J'ai donc supprimé ma div class="price_reduction" qui était à l'origine du souci

 

<div class="price_reduction">
{if $product.price_without_reduction > $product.price}
<span class="price-discount" style="text-decoration:line-through">
{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))}(-{$pro_specific_prices.reduction * 100|floatval}%)
	   {/if}
  {/if}
{/if}
</div>

 

et j'ai mis dans mon div right block le code suivant trouvé ici et adapté par mes soins pour permettre l'affichage et le calcul du % de réduction que la remise soit un montant défini ou un %.

 

{if $product.specific_prices.reduction_type == 'percentage'}
<s>{convertPrice price=$product.price_without_reduction}</s>
{/if}

{if $product.specific_prices.reduction_type == 'percentage'}
(- {$product.specific_prices.reduction*100} %)
{/if}

{if $product.specific_prices.reduction_type == 'amount'}
<s>{convertPrice price=$product.price_without_reduction}</s>
{/if}

{if $product.specific_prices.reduction_type == 'amount'}
(- {number_format(((($product.price_without_reduction - $product.price) / $product.price_without_reduction) * 100), 0)}%)
{/if}

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