Paolo666 Posted March 6, 2012 Share Posted March 6, 2012 Bonjour, Je voudrais modifier le lien de l’une des catégories du module block catégorie, Exemple : soit 3 catégories, je cherche une solution pour que quand le client clic sur la catégorie N°2 il sera dirigé vers une page que j’aurai crée . Merci pour votre aide Link to comment Share on other sites More sharing options...
Paolo666 Posted March 6, 2012 Author Share Posted March 6, 2012 tjr pas de réponse !!! Link to comment Share on other sites More sharing options...
IchabOd Posted March 6, 2012 Share Posted March 6, 2012 Ben voyons ! Et tu penses en avoir en écrivant de telles choses ? Link to comment Share on other sites More sharing options...
Paolo666 Posted March 6, 2012 Author Share Posted March 6, 2012 Franchement je commence à perdre espoir sur ce Forum, je pense que c’est pour la troisième ou quatrième fois que je pose un problème ou une question mais qui reste sans réponse. A quoi bon poster si on ne vous répond pas ! Link to comment Share on other sites More sharing options...
IchabOd Posted March 6, 2012 Share Posted March 6, 2012 Dans ton fichier blockcategory.tpl, il y a surement une structure de code de ce type (très grossièrement) : {foreach $Categories item=$category} [...] <a href="le_lien_vers_la_page_de_la_categorie">{$category.name|truncate....}</a> [...] {/foreach} C'est la balise <a href> qu'il faut modifier en mettant le bon lien et une condition pour que ce lien ne soit actif que pour la catégorie N°x Si par exemple tu as écris une page CMS ayant un id à 5, le lien de cette page CMS sera du type : <a href="cms.php?id_cms=5"> Donc en reprenant le code ci-dessus, tu mets une condition pour que ce lien ne s'affiche, par exemple, que pour la catégorie N°2 : {foreach $Categories item=$category} [...] {if $category.id == 2} <a href="cms.php?id_cms=5">{$category.name|truncate....}</a> {else} <a href="le_lien_vers_la_page_de_la_categorie">{$category.name|truncate....}</a> {/if} [...] {/foreach} Voilà c'est l'idée générale, il faut reprendre cet exemple avec les vraies variables utilisées dans cette page tpl. Pour les réponses effectivement je te rejoins, je trouve qu'il n'y en a pas beaucoup, et c'est malheureusement une des raisons qui m'avait poussé à prendre prestashop : la taille importante de la communauté, qui me semblait un atout essentiel. Il faut faire contre mauvaise fortune bon coeur et prendre son mal en patience... Link to comment Share on other sites More sharing options...
Paolo666 Posted March 6, 2012 Author Share Posted March 6, 2012 Merci pour votre proposition, jai également pensé à cette solution mais je « bloque » car dans blockcategory.tpl, il n’y a pas de : <a href= .........> Mais je trouve plutôt : {foreach from=$blockCategTree.children item=child name=blockCategTree } {if $smarty.foreach.blockCategTree.last} {include file="$branche_tpl_path" node=$child last='true'} {else} {include file="$branche_tpl_path" node=$child} {/if} {/foreach} Et c’est la ou je ne sais plus ou insérer mon : {if $category.id == 2} <a href="cms.php?id_cms=5">{$category.name|truncate....}</a> {else} <a href="le_lien_vers_la_page_de_la_categorie">{$category.name|truncate....}</a> {/if} Link to comment Share on other sites More sharing options...
IchabOd Posted March 6, 2012 Share Posted March 6, 2012 Donc il faut regarder alors dans le blockcategory.php pour voir comment est formé l'arbre des catégories... J'essayerai de regarder ce soir si tu ne trouves pas. Link to comment Share on other sites More sharing options...
Paolo666 Posted March 6, 2012 Author Share Posted March 6, 2012 Bonsoir, Tenez moi au courant si vous trouvez quelque chose ; Mille mercis Link to comment Share on other sites More sharing options...
IchabOd Posted March 7, 2012 Share Posted March 7, 2012 Essaye voir dans le fichier category-tree-branch.tpl, à la ligne 28 : <a href="{$node.link}" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> de la remplacer par : {if $currentCategoryId == 2} <a href="cms.php?id_cms=5" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {else} <a href="{$node.link}" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {/if} Toujours dans l'esprit où tu veux faire pointer ta catégorie 2 vers la page cms N° 5 Link to comment Share on other sites More sharing options...
Paolo666 Posted March 7, 2012 Author Share Posted March 7, 2012 rien ne change, j'ai toujours les produits de la catégorie 2 qui sont affichés Link to comment Share on other sites More sharing options...
Paolo666 Posted March 7, 2012 Author Share Posted March 7, 2012 le contenu de mon fichier category-tree-branch.tpl: <li {if isset($last) && $last == 'true'}class="last"{/if}> {if $currentCategoryId == 5} <a href="{$base_dir}modules/blockcategories/macategorie.php" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {else} <a href="{$node.link}" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {/if} {if $node.children|@count > 0} <ul> {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last} {include file="$branche_tpl_path" node=$child last='true'} {else} {include file="$branche_tpl_path" node=$child last='false'} {/if} {/foreach} </ul> {/if} </li> Link to comment Share on other sites More sharing options...
Nuvish Posted March 8, 2012 Share Posted March 8, 2012 Avec la solution de IchabOd,les catégories apparaitront bien. C'est juste le lien qui changera. Et c'est ce que tu a demandé. Link to comment Share on other sites More sharing options...
daniel3000 Posted March 9, 2012 Share Posted March 9, 2012 Question bête: après avoir modifié tes fichiers .tpl, as-tu pensé à vider ton cache smarty pour prise ne compte des modifications? Cordialement Daniel 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