red sun Posted March 15, 2013 Share Posted March 15, 2013 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... Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 15, 2013 Share Posted March 15, 2013 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. Quote Link to comment Share on other sites More sharing options...
red sun Posted March 15, 2013 Author Share Posted March 15, 2013 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. Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 15, 2013 Share Posted March 15, 2013 Let's try: {if !isset($page) || $page lt 2} Quote Link to comment Share on other sites More sharing options...
red sun Posted March 15, 2013 Author Share Posted March 15, 2013 Absolutely brilliant - that's working perfectly. Thank you so much for your help. Quote Link to comment Share on other sites More sharing options...
red sun Posted March 15, 2013 Author Share Posted March 15, 2013 I know this may sound dense - but how do I mark this as "resolved" so other users know there's a solution? Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted March 16, 2013 Share Posted March 16, 2013 For some reason only moderators can change threads to Resolved on this forum. Quote Link to comment Share on other sites More sharing options...
red sun Posted March 17, 2013 Author Share Posted March 17, 2013 Many thanks Dirty Butter - thought I was going mad when I couldn't find a way to edit the topic title. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.