ledmounting Posted January 8, 2016 Share Posted January 8, 2016 (edited) Bonjour Je suis en train d'adapter mon product.tpl et mon product-list.tpl pour générer automatiquement du contenu en fonction des caractéristiques. j'ai, sous le champs description, ajouté une nouvelle ≤div> qui contient des icons qui pour l'affichage ferons appel aux valeurs des caractéristique. En premier lieu j'ai ajouté cette div dans global.js pour l'affichage en product-list comme ceci function display(view) { if (view == 'list') { .............................. html += '<div itemprop="Information" class="desperso">'+ $(element).find('.desperso').html() + '</div>'; .............................. Créer un code identique sur mes deux tpl ( {foreach from=$features item=feature} pour product) et {foreach from=$product.features item=feature} pour la product-list) exemple pour l'image: <tr> {foreach from=$features item=feature} {if $feature.name == 'Nom de la caractéristique fr' && $feature.value !== ' ' && $feature.value !== '-' && $category->id == 311|| $feature.name == 'Nom de la caractéristique en' && $feature.value !== ' ' && $feature.value !== '-' && $category->id == 311} <td><img src="{$base_dir}img/cms/{$feature.value}.png" alt="{$feature.value}" title="{$feature.value}"/></td> {/if} {/foreach} </tr> Jusqu'ici aucun soucis tout s'affiche cependant quand j'ai un champs contenant plusieurs valeurs dans ma product-list la boucle se fait et m'affiche les valeur une à une, alors qu'en page product il l'affiche comme une chaine de caractère quelqu'un saurait-il pourquoi? Voici un exemple ex: Product-list: <tr> <td><img src="http://monsite/img/cms/img1.png" alt="img1" title="img1"/></td> <td><img src="http://monsite/img/cms/img2.png" alt="img2" title="img2"/></td> <td><img src="http://monsite/img/cms/img3.png" alt="img3" title="img3"/></td> <td><img src="http://monsite/img/cms/img4.png" alt="img4" title="img4"/></td> </tr> Product: <td><img src="http://monsite/img/cms/img1, img2, img3, img4.png" alt="img1, img2, img3, img4" title="img1, img2, img3, img4"/></td> Et dernier petit soucis en product-list si j'utilise "$category->id == " j'ai une belle erreur :/ Excusez pour le roman j'espère que quelqu'un pourra m'aider, en vous remerciant! (Version prestashop: 1.6.1.3 Thème personnalisé ) Edited January 8, 2016 by ledmounting (see edit history) Link to comment Share on other sites More sharing options...
Mediacom87 Posted January 8, 2016 Share Posted January 8, 2016 Salut, peut être que les features ne sont retourné par PrestaShop sous la même forme, donc je te conseille de faire un vardump pour comparer {$features|vardump} après pour l'id de la catégorie tu parles de quelle page, product ou product-list ? car eput être aussi que ce n'est pas la même variable appelé sur les 2 pages. Link to comment Share on other sites More sharing options...
ledmounting Posted January 8, 2016 Author Share Posted January 8, 2016 (edited) . Edited January 8, 2016 by ledmounting (see edit history) Link to comment Share on other sites More sharing options...
franckm1000 Posted January 8, 2016 Share Posted January 8, 2016 Evites de poster la même question partout non ??? https://www.prestashop.com/forums/topic/469701-remplacement-fiche-technique-produit-par-une-autre/ 1 Link to comment Share on other sites More sharing options...
ledmounting Posted January 8, 2016 Author Share Posted January 8, 2016 Pardon comment puis-je effacer ce topic ? 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