Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Customizing Category Pages

Customizing Category Pages

Locked

Views: 538

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
10 Dec 2010, 4:01 PM
#1
foteek avatar

foteek

New Zenner

Join Date:
May 2008
Posts:
50
Plugin Contributions:
0

Customizing Category Pages

I want to have completely custom category pages. For some, they would simply list the products like zen cart already does so nicely. But on others, I want to have special banners, customized text, and completely different layout. Essentially, I would be writing custom HTML for those.

What's the easiest way to do this? Is there a module, or something else? If not, do I just need to go into the category layout files and put big IF() statements around it for each category?

Thanks for any help.

TJ

10 Dec 2010, 4:29 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Customizing Category Pages

You could clone product_listing.php to product_listing2.php, and call for the appropriate one based on a category id or cPath test in /includes/modules/pages/index/main_template_vars.php (no override available; keep a backup and edit the core file)
around line 130:```php
} elseif ($category_depth == 'products' || zen_check_url_get_terms()) {

or around line 196:```php
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  $tpl_page_body = 'tpl_index_product_list.php';
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////
} else {

Alternatively, you could do as the Column Layout Grid mod does and have sections in product_listing.php based on current category instead of on row/column setting.

10 Dec 2010, 4:39 PM
#3
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Customizing Category Pages

Actually, considering this

$tpl_page_body = 'tpl_index_product_list.php';

you could probably put the conditional handling in a custom template copy of tpl_index_product_list.php, which would be better.
/includes/templates/your_template/templates/tpl_index_product_list.php

Sometimes the module file calls the tpl file, and sometimes it works the other way - I'm not sure why except that that is the way they were set up originally...

10 Dec 2010, 4:55 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Customizing Category Pages

Right, it's been a while since I've worked with the product listing page... the file that calls product_listing.php is /includes/templates/your_template/templates/tpl_modules_product_listing.php, which is called by tpl_index_product_listing.php.

Each layer of these files does some layout work, so where you need to intervene depends on what kinds of modifications you want to make.