Jump to content

Problème affichage différent selon le produit dans la liste des produits


Recommended Posts

Bonjour à tous,

 

J'ai un petit problème d'affichage dans ma liste des produits. J'utilise un thème personnalisé et je suis sous Prestashop 1.4.6.2.

 

Mon problème :

La colonne de droite ("prix réduit !", prix, "ajouter au panier", "voir le produit") s'affiche dans la colonne au centre mais ce que je ne comprend pas c'est que ça le fait que pour certains produits !

Mon fichier product-list.tpl et global.css semblent pourtant corrects.

 

product-list.tpl :

{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">
  <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} /></a>
  <div class="center_block">
<div class="product_flags">
 {if isset($product.new) && $product.new == 1}<span class="new">{l s='New'}</span>{/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'}{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{l s='Out of stock'}{/if}{if isset($product.online_only) && $product.online_only} ({l s='Online only!'}){/if}</span>{/if}
</div>
<h3><a class="product_link" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}</a></h3>
<p class="product_desc"><a class="product_descr" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|truncate:360:'...'|strip_tags:'UTF-8'|escape:'htmlall':'UTF-8'}">{$product.description_short|truncate:400:'...'|strip_tags:'UTF-8'}</a></p>
  </div>					
  <div class="right_block">
{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 (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
 {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}<span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>{/if}
{/if}
{if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
 {if ($product.allow_oosp || $product.quantity > 0)}
  <a class="exclusive 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 checkbox"><input type="checkbox" class="comparator" id="comparator_item_{$product.id_product}" value="comparator_item_{$product.id_product}" {if isset($compareProducts) && in_array($product.id_product, $compareProducts)}checked{/if}/> <label for="comparator_item_{$product.id_product}">{l s='Select to compare'}</label></p>
{/if}  
  </div>
 </li>
{/foreach}
</ul>
<!-- /Products list -->
{/if}

 

global.css :

/* ————— product-list.tpl ————— */
ul#product_list {padding:20px 0 0 10px;border-bottom:1px solid #cacaca;}
ul#product_list li {height:200px;padding:20px 0;border-top:1px solid #cacaca;}
ul#product_list li a.product_img_link {width:130px;height:200px;display:block;float:left;}
ul#product_list li a.product_img_link img {margin:35px 0 0 0;}
ul#product_list li div.center_block {width:390px;float:left;margin:0 0 0 20px;}
ul#product_list li div.center_block div.product_flags {height:26px;}
ul#product_list li div.center_block div.product_flags span {height:20px;display:block;float:left;padding:6px 10px 0 10px;font-size:11px;font-weight:bold;text-transform:uppercase;}
ul#product_list li div.center_block div.product_flags span.new {margin:0 10px 0 0;background:#dd8551;color:#fff;}
ul#product_list li div.center_block div.product_flags span.availability {background:#f5f5f5;color:#333;}
ul#product_list li div.center_block h3 {padding:17px 0 0 0;}
ul#product_list li div.center_block p.product_desc {padding:13px 0 0 0;}
ul#product_list li div.center_block div.right_block {width:120px;float:right;right:-100px;}
ul#product_list li div.right_block {width:120px;float:right;}
ul#product_list li div.right_block span.on_sale,
ul#product_list li div.right_block span.discount {display:block;padding:5px 0 20px 0;}
ul#product_list li div.right_block span.price {display:block;padding:5px 0 0 0;}
ul#product_list li div.right_block .exclusive {margin:17px 0 5px 0;}
ul#product_list li div.right_block p.compare {height:15px;padding:15px 0 0 0;}
*+html ul#product_list li div.right_block p.compare input {margin-right:-4px;}

 

Savez-vous d'où cela peut venir ? :(

 

Merci d'avance.

post-339919-0-78936700-1372420602_thumb.png

Link to comment
Share on other sites

ok, ça viens des "truncate" tu as certainement un module qui a te permet de mettre en forme les descriptions de catégories, mais ceci met des div, des span le problème avec le truncate ça coupe la chaine les descriptions avec des div et span ouvert et non fermés.

 

Essaye en changeant le {$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'} par {$product.name|strip_tags|truncate:35:'...'|escape:'htmlall':'UTF-8'}

Edited by coeos.pro (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

dans le productlist.tpl

après la balise </h3> et avant </li>

remplacez tout par:

   <p class="product_desc"><a class="product_descr" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|truncate:360:'...'|strip_tags:'UTF-8'|escape:'htmlall':'UTF-8'}">{$product.description_short|truncate:400:'...'|strip_tags:'UTF-8'}</a></p>
  </div>					
  <div class="right_block">
   {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 (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
 {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}<span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>{/if}
   {/if}
   {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
 {if ($product.allow_oosp || $product.quantity > 0)}
  <a class="exclusive 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 checkbox"><input type="checkbox" class="comparator" id="comparator_item_{$product.id_product}" value="comparator_item_{$product.id_product}" {if isset($compareProducts) && in_array($product.id_product, $compareProducts)}checked{/if}/> <label for="comparator_item_{$product.id_product}">{l s='Select to compare'}</label></p>
   {/if}   
  </div>

Link to comment
Share on other sites

Merci de la réponse. Néanmoins j'ai remplacé le code comme indiqué et hélas aucune modification visible... J'ai désactivé le cache smarty et forcé la compilation.

 

Je ne désespère pas mais j'aimerai bien comprendre.

 

Merci d'avance

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