webspider Posted March 15, 2015 Share Posted March 15, 2015 Bonjour , dans le fichier category.tpl je souhaiterais modifier cette fonction : {foreach from=$subcategories item=subcategory} <li class="col-lg-2-4 col-md-3 col-xs-12"> <div class="subcategory-image"> <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}" title="{$subcategory.name|escape:'html':'UTF-8'}" class="img"> {if $subcategory.id_image} <img class="replace-2x" src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'sub_cat')|escape:'html':'UTF-8'}" alt="" /> {else} <img class="replace-2x" src="{$img_cat_dir}default-medium_default.jpg" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" /> {/if} </a> </div> <h5><a class="subcategory-name" href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}">{$subcategory.name|truncate:25:'...'|escape:'html':'UTF-8'|truncate:350}</a></h5> {if $subcategory.description} <div class="cat_desc">{$subcategory.description}</div> {/if} </li> {/foreach} en fait je souhaiterais que la taille des images de sous categories varient suivant la page affichée , pour faire plus concret , si la page en cours est lesite.com/index.php?id_category=3&controller=category je voudrais que la valeur de $subcategory.id_image, soit 'sub_cat2' et sinon $subcategory.id_image, soit 'sub_cat' quelqun pourrais il me dire comment faire ? d'avance merci !! Link to comment Share on other sites More sharing options...
Szed Posted March 15, 2015 Share Posted March 15, 2015 il vous faut tester l'id de la catégorie, par exemple : {if $category.id == 3} <img class="replace-2x" src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'sub_cat2')|escape:'html':'UTF-8'}" alt="" /> {else} <img class="replace-2x" src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'sub_cat')|escape:'html':'UTF-8'}" alt="" /> {/if} Link to comment Share on other sites More sharing options...
webspider Posted March 15, 2015 Author Share Posted March 15, 2015 Bonjour et merci pour votre reponse , voici ce que j'ai fait au niveau du code , j'ai tenté quelques autres solutions mais sans succès , la page ne s'affiche pas ou ne s'affiche pas correctement {foreach from=$subcategories item=subcategory} <li class="col-lg-2-4 col-md-3 col-xs-12"> <div class="subcategory-image"> <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}" title="{$subcategory.name|escape:'html':'UTF-8'}" class="img"> {if $subcategory.id_image} {if $category.id == 3} <img class="replace-2x" src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'cat_tabs')|escape:'html':'UTF-8'}" alt="" /> {else} <img class="replace-2x" src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'sub_cat')|escape:'html':'UTF-8'}" alt="" /> {/if} {/if} {else} <img class="replace-2x" src="{$img_cat_dir}default-medium_default.jpg" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" /> {/if} </a> </div> <h5><a class="subcategory-name" href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}">{$subcategory.name|truncate:25:'...'|escape:'html':'UTF-8'|truncate:350}</a></h5> {if $subcategory.description} <div class="cat_desc">{$subcategory.description}</div> {/if} </li> {/foreach} Link to comment Share on other sites More sharing options...
Szed Posted March 16, 2015 Share Posted March 16, 2015 Erreur de ma part : remplacez {if $category.id == 3} par {if $category->id == 3} Link to comment Share on other sites More sharing options...
webspider Posted March 16, 2015 Author Share Posted March 16, 2015 Je viens de tenter mais toujours le meme probleme pour moi , le fait de modifier la fonction fait que les categories n'affichent plus rien du tout , voici le fichier category.tpl entier, si quelqun peut m'aider a resoudre ce probleme cela m'avancerais beaucoup ! {* * 2007-2014 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2014 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} {include file="$tpl_dir./errors.tpl"} {if isset($category)} {if $category->id AND $category->active} <h1 class="page-heading{if (isset($subcategories) && !$products) || (isset($subcategories) && $products) || !isset($subcategories) && $products} product-listing{/if}"><span class="cat-name">{$category->name|escape:'html':'UTF-8'}{if isset($categoryNameComplement)} {$categoryNameComplement|escape:'html':'UTF-8'}{/if}</span>{include file="$tpl_dir./category-count.tpl"}</h1> <div class="box-content"> {if $scenes || $category->description || $category->id_image} <div class="content_scene_cat"> {if $scenes} <div class="content_scene"> <!-- Scenes --> {include file="$tpl_dir./scenes.tpl" scenes=$scenes} {if $category->description} <div class="cat_desc rte"> {if Tools::strlen($category->description) > 350} <div id="category_description_short">{$description_short}</div> <div id="category_description_full" class="unvisible">{$category->description}</div> <a href="{$link->getCategoryLink($category->id_category, $category->link_rewrite)|escape:'html':'UTF-8'}" class="lnk_more">{l s='More'}</a> {else} <div>{$category->description}</div> {/if} </div> {/if} </div> {else} <!-- Category image --> <div class="content_scene_cat_bg"> {if $category->id_image} <img class="img-responsive" src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category_default')|escape:'html':'UTF-8'}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" /> {/if} {if $category->description} <div class="cat_desc"> <span class="category-name"> {strip} {$category->name|escape:'html':'UTF-8'} {if isset($categoryNameComplement)} {$categoryNameComplement|escape:'html':'UTF-8'} {/if} {/strip} </span> {if Tools::strlen($category->description) > 350} <div id="category_description_short" class="rte">{$description_short}</div> <div id="category_description_full" class="unvisible rte">{$category->description}</div> <a href="{$link->getCategoryLink($category->id_category, $category->link_rewrite)|escape:'html':'UTF-8'}" class="lnk_more">{l s='More'}</a> {else} <div class="rte">{$category->description}</div> {/if} </div> {/if} </div> {/if} </div> {/if} {if isset($subcategories)} {if (isset($display_subcategories) && $display_subcategories eq 1) || !isset($display_subcategories) } <!-- Subcategories --> <div id="subcategories"> <p class="subcategory-heading">{l s='Subcategories'}</p> <ul class="clearfix row"> <!-- Partie a modifier assigner une taille d'image differente suivant la categorie affichee --> {foreach from=$subcategories item=subcategory} <li class="col-lg-2-4 col-md-3 col-xs-12"> <div class="subcategory-image"> <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}" title="{$subcategory.name|escape:'html':'UTF-8'}" class="img"> {if $subcategory.id_image} [spam-filter]if $category->id == 3[spam-filter] <img class="replace-2x" src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'cat_tabs')|escape:'html':'UTF-8'}" alt="" /> {else} <img class="replace-2x" src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'sub_cat')|escape:'html':'UTF-8'}" alt="" /> {/if} {/if} {else} <img class="replace-2x" src="{$img_cat_dir}default-medium_default.jpg" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" /> {/if} </a> </div> <h5><a class="subcategory-name" href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}">{$subcategory.name|truncate:25:'...'|escape:'html':'UTF-8'|truncate:350}</a></h5> {if $subcategory.description} <div class="cat_desc">{$subcategory.description}</div> {/if} </li> {/foreach} </ul> </div> {/if} {/if} {if $products} <div class="content_sortPagiBar product-filter clearfix"> <div class="sortPagiBar clearfix"> <div class="col-sm-7 col-md-7 col-xs-12"> <div class="sort"> {include file="./product-sort.tpl"} </div> </div> <div class="col-sm-5 col-md-5 col-xs-12"> <div class="limit"> {include file="./nbr-product-page.tpl"} </div> <div class="product-compare"> {include file="./product-compare.tpl"} </div> </div> </div> </div> {include file="./product-list.tpl" products=$products} <div class="content_sortPagiBar"> <div class="bottom-pagination-content clearfix"> {include file="./product-compare.tpl" paginationId='bottom'} {include file="./pagination.tpl" paginationId='bottom'} </div> </div> {/if} </div> {elseif $category->id} <p class="alert alert-warning">{l s='This category is currently unavailable.'}</p> {/if} {/if} Link to comment Share on other sites More sharing options...
Szed Posted March 16, 2015 Share Posted March 16, 2015 VOus avez une erreur la déjà : [spam-filter]if $category->id == 3[spam-filter] Trop d'accolade. Link to comment Share on other sites More sharing options...
webspider Posted March 19, 2015 Author Share Posted March 19, 2015 Bonjour , je viens de voir le probleme avec les accolades mais c'est une faut de frappe de ma part , dans la pratique cela est corrigé et j'ai toujours le meme probleme . c'est pourtant simple en théorie et dans la pratique ca ne fonctionne pas , j'avoue caler sur ce probleme , toute aide est la bienvenue !! en vous remerciant d'avance @+ 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