abdamu Posted November 19, 2021 Share Posted November 19, 2021 (edited) Hello, I have updated my prestashop from 1.5 to 1.7 and it had modifications made. It had a button to navigate back from one category or subcategory to another. But the code does not work for me now in version 1.7, and I wanted you to give me a hand to adapt it to work in that version. I attach the code that I had in "category.tpl" Thanks in advance <!-- Subcategories --> <div id="subcategories"> <h3>{l s='Subcategories'}</h3> <script type="text/javascript" > $(window).load(function() { setHeight2('.grid_list_categories li'); }); </script> <div class='divCentre'> <ul class="grid_list_categories clearfix"> {if $category->id_parent!=2} <li> <a href="{$link->getCategoryLink($category->id_parent)}" title="Ver Categoría Superior" class="img"> <img src="/img/imgSubCat/return.jpg" alt="return" /> </a> <a href="{$link->getCategoryLink($category->id_parent)}" class="cat_name">Ver Categoría Superior</a> </li> {/if} {if isset($subcategories)} {foreach from=$subcategories item=subcategory} <li> <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}" class="img"> {if $subcategory.id_image} <img src="/img/imgSubCat/{$subcategory.link_rewrite|escape:'htmlall':'UTF-8'}.jpg" alt="{$subcategory.name|escape:'htmlall':'UTF-8'}" /> {else} <img src="{$img_cat_dir}default-medium_default.jpg" alt="" /> {/if} </a> <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" class="cat_name">{$subcategory.name|escape:'htmlall':'UTF-8'|truncate:42:'...'}</a> </li> {/foreach} {/if} </ul> </div> <br class="clear"/> </div> {/if} Edited November 19, 2021 by abdamu (see edit history) Link to comment Share on other sites More sharing options...
abdamu Posted December 30, 2021 Author Share Posted December 30, 2021 (edited) {if $category->id_parent!=2} <li> <a href="{$link->getCategoryLink($category->id_parent)}" title="Ver Categoría Superior" class="img"> <img src="/warehouse/img/imgSubCat/volver.jpg" alt="volver" /> </a> <a href="{$link->getCategoryLink($category->id_parent)}" class="cat_name">Ver Categoría Superior</a> </li> {/if} Hello again, can anyone help me to adapt this code to work with PS 1.7? I had it in P.S 1.5 and when I was in a subcategory or category, pressing the button redirected me to a parent category. The error is thrown at me in the code {$link->getCategoryLink($category->id_parent)} Does anyone know how to make it compatible with PS 1.7? 🤨 Edited December 31, 2021 by abdamu (see edit history) Link to comment Share on other sites More sharing options...
Nickz Posted December 31, 2021 Share Posted December 31, 2021 4 minutes ago, abdamu said: Does anyone know how to make it compatible with PS 1.7? I'm pretty sure @musicmaster can help Link to comment Share on other sites More sharing options...
ps8modules Posted December 31, 2021 Share Posted December 31, 2021 {url entity='category' id=$id_category id_lang=$id_lang} Change id_category to parent category id variable. Link to comment Share on other sites More sharing options...
ps8modules Posted December 31, 2021 Share Posted December 31, 2021 Category image path. {url entity='categoryImage' id=$id_category name='home-default'} Change home-default (image size) and id_category to your variable. Link to comment Share on other sites More sharing options...
abdamu Posted December 31, 2021 Author Share Posted December 31, 2021 (edited) hace 8 horas, 4you.software dijo: {url entity='category' id=$id_category id_lang=$id_lang} Change id_category to parent category id variable. Thanks for your quick response. Friend, I am not looking for a specific category, it has to work on all subcategories. Like a navigation button, it returns to the parent or previous category. I don't know if you understand what I'm looking for ... {if $category->id_parent!=2} I am assuming this is based as a reference on the category "HOME"🤨 Edited December 31, 2021 by abdamu (see edit history) Link to comment Share on other sites More sharing options...
ps8modules Posted December 31, 2021 Share Posted December 31, 2021 (edited) {if $category.id_parent != '2'} <li> <a href="{url entity='category' id=$category.id_parent id_lang=$language.id}" title="Ver Categoría Superior" class="img"> <img src="./img/imgSubCat/volver.jpg" alt="volver" /> </a> <a href="{url entity='category' id=$category.id_parent id_lang=$language.id}" class="cat_name">Ver Categoría Superior</a> </li> {/if} Tested 1.7.7.0 and work. ./themes/your-theme/templates/catalog/listing/product-list.tpl Edited January 2, 2022 by 4you.software (see edit history) 1 Link to comment Share on other sites More sharing options...
abdamu Posted December 31, 2021 Author Share Posted December 31, 2021 (edited) hace 2 horas, 4you.software dijo: {if $category.id_parent != '2'} <li> <a href="{url entity='category' id=$category.id_parent id_lang=$language.id}" title="Ver Categoría Superior" class="img"> <img src="https://www.mercanutri.com/themes/warehouse/img/imgSubCat/volver.jpg" alt="volver" /> </a> <a href="{url entity='category' id=$category.id_parent id_lang=$language.id}" class="cat_name">Ver Categoría Superior</a> </li> {/if} Tested 1.7.7.0 and work. ./themes/your-theme/templates/catalog/listing/product-list.tpl ok thanks now work perfect. PS: please delete domain of the post Thanks Edited December 31, 2021 by abdamu (see edit history) 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