Jump to content

Resolved - Only show category description/image once


red sun

Recommended Posts

Is there a way to only show the category description / associated image on the first page of each category's product listings?

 

The site I'm working on has a lovely big image gallery on each category landing page. This is fine for the first page, but it gets a bit tedious when you navigate through the next paginated pages of products and it's still at the top of the page.

 

Many thanks...

 

Link to comment
Share on other sites

I don't have enough products in the database to cause pagination, so this may or may not work.

 

Let's try this: assuming when the pagination is presented, there is a display logic variable we can test for: $page. Assuming $page is zero-based. If $page is one-based, we will need to make a small adjustment.

 

In the file /skins/YOUR_SKIN/templates/content.category.php, very near the top, find:

 

{if isset($category.image)}
<div id="category_image"><img src="{$category.image}" alt="{$category.cat_name}" /></div>
{/if}

{$category.cat_desc}

Change this to:

 

{if !isset($page) || empty($page)}
{if isset($category.image)}
<div id="category_image"><img src="{$category.image}" alt="{$category.cat_name}" /></div>
{/if}

{$category.cat_desc}
{/if}

This tests for $page being missing (no pagination needed), or $page being empty (equal to 0 or being the first page - hopefully). If so, we are on the first page and the category image and description will be presented. If we are on page 1 (actually being the second page), these won't be presented.

Link to comment
Share on other sites

Hi bsmithers - many, many thanks for getting back to me. Unfortunately that didn't work as it removed the category description from all pages.

 

{if !isset($page) || empty($page)}
<div class="description">{$category.cat_desc}</div>
{/if}
 

If it's any help, the url is formed as "mydomain.com/mycat.html?page=1" for the first page and incrementing for subsequent pages, so guess we need to test for equal to or greater than 1? I tried a few attempts at this but without any luck - I'm a designer not a coder.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...