Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Infobox for each category


Hunaid

Recommended Posts

Hi,

 

I have three categories on my site :

- Notebooks

- Part Centre

- Accessories

 

How do I make them appear seperately in three different infoboxes? Like one for Note with list of sub-categories like; Acer, Dell and so on. Similary with Part Centre and Accessories?

 

Can anyone help me?

 

Thanks

Link to comment
Share on other sites

you could duplicate the includes/boxes/categories.php file and customize each for a specific category.

 

so for example, in addition to categories.php, copy that to both categories2.php and categories3.php.

 

then, get the id of your top level categories (look at cPath in the url). and say Notebooks has id=21, Part Center has id=22, and Accessories has id=23

 

find this code in each file

   $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

 

and change the where c.parent_id = '0' to where c.parent_id = '21' in categories.php, where c.parent_id = '22' in categories2.php, and where c.parent_id = '21' in categories3.php

 

that will make each start from the respective category rather than the very top.

 

to avoid errors, you'll also need to rename the tep_show_category in the other files. easy to just change them to tep_show_category2 in categories2.php and tep_show_category3 in categories3.php. I believe there's 3 of them in the file, so make sure to change all of them.

 

other than that, you'll probably want to change the heading for each also. If you're not worried about languages and such, you can just change them in the files in the line

 $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);

 

ie, change that to $info_box_contents[] = array('text' => 'Notebooks'); in categories.php, $info_box_contents[] = array('text' => 'Part Centre'); in categories2.php, and $info_box_contents[] = array('text' => 'Accessories'); in categories3.php

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...