Jump to content

[DIRTY SOLUTION] Show category description only on first product listing page


qroft

Recommended Posts

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

  • 7 months later...
  • 8 months later...

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}

 

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...