Jump to content

Présentation des produits


Recommended Posts

Bonjour,

 

Je ne sais plus qui demandait la solution pour voir les produits de chaque catégorie de la même façon que le module "produits phares".

Mais à force de bidouiller j'ai obtenu le résultat escompté pour mon thème.

 

on récupère dans le module home featured dans le fichier homefeatured.tpl le code suivant en changeant la balise div par la balise table

 

<table class="space">

{if isset($products)}

{counter start=0 assign=nbPrd}

{foreach from=$products item=value}

{assign var='productLink' value=$link->getProductLink($value.id_product, $value.link_rewrite)}

{if isset($value.attributes_small)}

{assign var='productName' value=$value.name|cat:' ':$value.attributes_small|truncate:36}

{else}

{assign var='productName' value=$value.name|truncate:36}

{/if}

 

{if $nbPrd % 4 == 0}<div class="space">{/if}

 

<div class="featured_product">

<a href="{$productLink}">

<img src="{$img_prod_dir}{$value.id_image}-medium.jpg" alt="{$value.legend}" title="{$value.legend}" class="product_image bspace" />

</a>

<h2 class="product_name">

<a href="{$productLink}" class="product_link">

{$productName}

</a>

</h2>

<span class="price">{displayWtPrice p=$value.price}</span>

<br />

<!-- View Button-->

<a href="{$productLink}">

<img src="{$img_dir}{$lang}/btn-view.gif" alt="" title="{l s='View' mod='homefeatured'}" class="tspace" />

</a>

 

<!-- Add to cart Button -->

<a href="{$base_dir}cart.php?qty=1&id_product={$value.id_product}&add">

<img src="{$img_dir}{$lang}/btn-add.gif" alt="" title="{l s='Add to cart' mod='homefeatured'}" class="add_to_cart_btn" />

</a>

</div>

 

<!-- Dashed separation -->

{counter print=false}

{if $nbPrd % 4 != 0}<div class="featured_sep"></div>{/if}

<!-- Line separation -->

 

{if $nbPrd % 4 == 0 || $nbPrd == $productNumber}

<!-- Clear -->

<div class="clear featured_line"></div>

</div>

{/if}

{/foreach}

{/if}

</table>

 

Ce code on le colle dans votre thème dans le fichier category.tpl à la place de :

 

<table class="product_list">

<tr>

<th>{l s='Picture'}</th>

<th>

{l s='Product'}

<a href="{$link->goLink('name', 'desc')}"><img src="{$img_dir}down.gif" alt="{l s='down'}" /></a>

<a href="{$link->goLink('name', 'asc')}"><img src="{$img_dir}up.gif" alt="{l s='up'}" /></a>

</th>

<th>

{l s='Avail.'}

<a href="{$link->goLink('quantity', 'desc')}"><img src="{$img_dir}down.gif" alt="{l s='down'}" /></a>

<a href="{$link->goLink('quantity', 'asc')}"><img src="{$img_dir}up.gif" alt="{l s='up'}" /></a>

</th>

<th>

{l s='Price'}

<a href="{$link->goLink('price', 'desc')}"><img src="{$img_dir}down.gif" alt="{l s='down'}" /></a>

<a href="{$link->goLink('price', 'asc')}"><img src="{$img_dir}up.gif" alt="{l s='up'}" /></a>

</th>

</tr>

<tr class="separator">

<td colspan="4" class="separator"></td>

</tr>

 

<!-- Products informations -->

{foreach from=$products item=product}

<tr class="product">

<!-- Image -->

<td>

<a href="{$product.link}">

<img src="{$img_prod_dir}{$product.id_image}-medium.jpg" alt="{$product.legend}" title="{$product.legend}" />

</a>

</td>

 

<!-- Name and description -->

<td>

<h3><a href="{$product.link}" class="product_link">{$product.name|truncate:40}</a></h3>

<div class="cat_prod_description">

{$product.description_short|strip_tags|truncate:150}

</div>

</td>

 

<!-- Availability -->

<td class="middle">

{if ($product.allow_oosp OR $product.quantity > 0)}

<img src="{$img_dir}available.gif" alt="{l s='Available'}" title="{l s='Available'}" />

{else}

<img src="{$img_dir}unavailable.gif" alt="{l s='Out of stock'}" title="{l s='Out of stock'}" />

{/if}

</td>

 

<!-- Price and actions -->

<td class="price">

{productPrice p=$product}

{if ($product.allow_oosp OR $product.quantity > 0)}

<a href="cart.php?add&id_product={$product.id_product}">

<img src="{$img_dir}btn-add-small.gif" alt="{l s='Add to cart'}" title="{l s='Add to cart'}" class="add_to_cart" />

</a>

{/if}

<br />

<a href="{$product.link}" class="product_link">

<img src="{$img_dir}{$lang_iso}/btn-view.gif" alt="View" title="View" class="tspace" />

</a>

</td>

</tr>

<tr class="separator2">

<td colspan="4" class="separator2"></td>

</tr>

{/foreach}

</table>

 

 

Voilà, bonne bidouille  :)

Link to comment
Share on other sites

  • 3 months later...
×
×
  • Create New...