qroft Posted June 18, 2017 Share Posted June 18, 2017 I am new to Prestashop and theme development, so please bare if this workaround is more than dirty! My Wish I want to show the category description only on the first page of the category listing (Prestashop 1.7.x). My Solution In short: Check the current page of the pagination and if it is "1", then simply make jQuery hide the description. What i did is opening the pagination.tpl found under templates -> partials -> pagination.tpl There i added this code on top of everything: {if $pagination.pages[1].current != true} <script> $(document).ready(function() { $('#category-description').css('display','none'); }); </script> {/if} What this code does is this: Line 1: check the pagination page and if it is not the first page, then start the jQuery script once that the document is ready Line 4: hide the element with the ID #category-description As i said, i am new to the whole Prestashop stuff, so please bare if this is totally wrong, but it works for me. Link to comment Share on other sites More sharing options...
Daresh Posted June 18, 2017 Share Posted June 18, 2017 Dirty and quite useless. That descriptions is recommended to be hidden for SEO reasons, so you must do it in the tpl file. Check the $p variable value. 1 Link to comment Share on other sites More sharing options...
qroft Posted June 19, 2017 Author Share Posted June 19, 2017 Thanks Daresh, but i had problems in getting the $p to be recognized (in 1.7) Greetings from this corner of the planet. Link to comment Share on other sites More sharing options...
robbie007 Posted February 13, 2018 Share Posted February 13, 2018 Is the are good solution for Prestashop 1.7 ??? Link to comment Share on other sites More sharing options...
prolink Posted October 17, 2018 Share Posted October 17, 2018 Hi guys. My solution for PS 1.7: in /templates/catalog/listing/category.tpl add simple smarty checking if page url doesn't contain "?page=". So in the .tpl file it will be like: {if !$smarty.server.REQUEST_URI|strstr:'?page='} <div id="category-description" class="text-muted">{$category.description nofilter}</div> {/if} 1 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