Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Remove Category description on pages greater than 2

Remove Category description on pages greater than 2

Locked

Views: 1,441

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
28 Sep 2007, 1:02 AM
#1
cpk avatar

cpk

New Zenner

Join Date:
Apr 2006
Posts:
37
Plugin Contributions:
0

Remove Category description on pages greater than 2

Hello all PHP/Zen Cart gurus,

My client wants the category description to display only on the first page of any group of products that has more than one page. Subsequent pages should only list the products from that category.

I have done extensive searching of the forum and discovered that this functionality cannot be set from within the ZC admin and will require custom PHP coding by overriding the tpl_index_product_list.php file.

While my PHP skills are not great, I believe I understand the logic that will need to be set up for this to work properly but I am unsure how I might set the script to trigger only on pages that number greater than 1.

I think that if I wrap the $current_categories_description variable in a conditional statement that will identify the current page as greater than or equal to 2, I can get it to display on just the first product listing page of each category and no other.

What I need help with is how to determine the condition I have specified. I believe that this can be accomplished with something like the following:

 if (page_count_variable >=2) {echo $current_categories_description;}

I have already successfully tested a similar script to see if this will work by testing a specific category number (to the exclusion of others) against the the $current_category_id variable but have not been able to figure out a straightforward way to capture current page number. The answer seems to be dependent on the number of products to be displayed on each page and displays only in the URL which is a string of several parameters. I would like the script to recognize any changes to the number of displayed products as specified in the admin.

Any help would be greatly appreciated. I will post the solution as a "How to" in the downloads as this will help others who have searched for this feature.

Thanks,

cpk

28 Sep 2007, 1:07 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Remove Category description on pages greater than 2

You could just alter the tpl_index_product_listing.php

// categories_description
if ($current_categories_description != '') {

To read:

// categories_description
if ($current_categories_description != '' and $_GET['page'] <= 1) {

Now if the page is blank or page 1 of the listing you see it ... and if any other page you don't ...

28 Sep 2007, 7:50 AM
#3
cpk avatar

cpk

New Zenner

Join Date:
Apr 2006
Posts:
37
Plugin Contributions:
0

Re: Remove Category description on pages greater than 2

Ajeh:

You could just ...

As usual, I over thought my solution to the problem. Thanks for coming to the rescue Linda.

Keep up the good work!

cpk