This is a discussion on 2 category boxes within the osCMax v1.7 Discussion forums, part of the osCMax v1.7 Forums category; My client wants me to have 2 category combo boxes. 1. that has all categories that are NOT X 2 ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| My client wants me to have 2 category combo boxes. 1. that has all categories that are NOT X 2 Just category X (which has hundreds of sub categories) I think the best way to handle this is to create 2 category boxes and change the underlying SQL query What would that be (the query change)? for both? |
|
#2
| |||
| |||
| set up the big category as normal. Then find its id. Then open includes/boxes/categories.php and save it as something else (second_categories.php) and...: 1) remove category from original box: line 88 of the ORIGINAL categories: $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"); insert: c.categories_id != {the special id} and after the WHERE clause. 2) in the second-categories.php: $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.categories_id = {special category id} and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); (replace the {special category id} with the cID of your special. This will select only the special one as the base category). um, I think that should work. Obviously it assumes the special category has parent_id = 0 (it's a base category, not a sub-category). You may run into some namespace conflicts re-using the categories file... just change the offending ones if that happens. Or better still initialise them all at the start, some already are eg: $boxContent = ''; $tree = array(); hope this helps jon |
|
#3
| |||
| |||
| oh yes, then obviously include() the second_categories.php in your column_left or wherever you want it. jw |
|
#4
| |||
| |||
| Quote:
got this error Fatal error: Cannot redeclare tep_show_category() in /var/www/html/blokey/catalog/includes/boxes/categories.php on line 17 |
|
#5
| |||
| |||
| Ah yes, sorry... I forgot about that, the function tep_show_category is declared in that file. You need to remove it from the second of the category boxes, whichever you list first in the column_left needs to contain it, and not in the second. Better still take it out of both and place it in includes/functions/general then it won't matter which order you put the boxes in. it goes from line 17 to 71 in the categories.php file. Just chop all the code on those lines. jon |
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding Category Descriptions in Category List for each Cat. | el1jones | osCMax v2 Customization/Mods | 1 | 03-15-2006 01:37 AM |
| Remove certain boxes from specific category | auntie22 | osCMax v1.7 Discussion | 1 | 10-25-2005 06:39 PM |
| change boxes background color now have double boxes | ANNIE11 | osCMax v1.7 General Mods Discussion | 0 | 08-22-2005 07:16 PM |
| New category does not create new category folder | Anonymous | osCommerce 2.2 Installation Help | 3 | 02-23-2003 12:52 PM |