Sophie09 Posted February 12, 2021 Share Posted February 12, 2021 Bonjour, je souhaite afficher le nom de la marque (fabricant) dans la liste des produits (normalement c'est product-list.tpl). exemple : quand on affiche sur le front du eshop tous les produits , il doit y avoir nom du produit - marque - prix. j'ai déjà trouvé le code pour afficher la marque dans la fiche produit (product.tpl) mais ce même code ne fonctionne pas dans product-list.tpl. j'ai cherché partout sur le forum et google et je ne trouve rien dans ce sens. soit je ne mets pas le code au bon endroit, ou il manque une variable ou ce n'est pas la bonne page . Les deux codes ci-dessous ne fonctionnent pas dans product-list.tpl voici le code que j'ai trouvé : <p {if !$product->manufacturer_name}style="display: none;"{/if}> <a href="{$link->getManufacturerLink($product->id_manufacturer)}"> <label>{l s='Fabricant:'} </label> <span>{$product->manufacturer_name|escape:'htmlall':'UTF-8'}</span> </a> </p> et l'autre code que j'ai réellement dans ma fiche produit {if $product_manufacturer->id_manufacturer} {assign var="myfile" value="img/m/{$product_manufacturer->id_manufacturer}-mf_image2.jpg"} {if file_exists($myfile)} {if !$content_only}<a href="{$link->getmanufacturerLink($product->id_manufacturer, $product_manufacturer->link_rewrite)}" title="{l s='All products of this manufacturer'}"> {/if} <span itemprop="brand" style="display: none">{$product_manufacturer->name}</span> <img class="imglog" alt="{$product_manufacturer->name}" src="{$base_dir_ssl}img/m/{$product_manufacturer->id_manufacturer}-mf_image2.jpg" />{if !$content_only}</a>{/if}{else}<label>{l s='Manufacturer:'}</label> {if !$content_only}<a class="manname" href="{$link->getmanufacturerLink($product->id_manufacturer, $product_manufacturer->link_rewrite)}" title="{l s='All products of this manufacturer'}">{/if}<span itemprop="brand">{$product_manufacturer->name}</span>{if !$content_only}</a>{/if}{/if} {/if} Merci Link to comment Share on other sites More sharing options...
Mediacom87 Posted February 12, 2021 Share Posted February 12, 2021 Bonjour, si vous voulez gagner du temps il reste toujours la solution module : https://www.prestatoolbox.fr/referencement-seo/214-afficher-le-logo-du-fabricant-et-ou-du-fournisseur.html Link to comment Share on other sites More sharing options...
Ij2021 Posted February 13, 2021 Share Posted February 13, 2021 (edited) Bonjour, Essaye ce bout de code sous le nom du produit dans le product-list tpl <p itemprop="brand">{if !empty($product.manufacturer_name)} <a href="{$link->getManufacturerLink($product.id_manufacturer)|escape:'html':'UTF-8'}" >{$product.manufacturer_name|escape:'html':'UTF-8'} </a> {/if} </p> Edited February 13, 2021 by EnguerranIJ (see edit history) Link to comment Share on other sites More sharing options...
Sophie09 Posted February 14, 2021 Author Share Posted February 14, 2021 23 hours ago, EnguerranIJ said: Bonjour, Essaye ce bout de code sous le nom du produit dans le product-list tpl <p itemprop="brand">{if !empty($product.manufacturer_name)} <a href="{$link->getManufacturerLink($product.id_manufacturer)|escape:'html':'UTF-8'}" >{$product.manufacturer_name|escape:'html':'UTF-8'} </a> {/if} </p> C'est génial ! ça fonctionne très bien Merci beaucoup Link to comment Share on other sites More sharing options...
Sophie09 Posted February 14, 2021 Author Share Posted February 14, 2021 On 2/12/2021 at 11:25 PM, Mediacom87 said: Bonjour, si vous voulez gagner du temps il reste toujours la solution module : https://www.prestatoolbox.fr/referencement-seo/214-afficher-le-logo-du-fabricant-et-ou-du-fournisseur.html Bonjour, EnguerranIJ m'a donné un code et ça fonctionne . je garde quand même ton site en favoris Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now