osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

2 category boxes

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 ...


Go Back   osCommerce and osCMax shopping cart software forums > osCMax v1.7 Forums > osCMax v1.7 Discussion

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 02-27-2004, 04:26 AM
Active Member
 
Join Date: Aug 2003
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
jloyzaga
Default 2 category boxes

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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #2  
Old 02-27-2004, 05:36 AM
Active Member
 
Join Date: Jan 2003
Location: Surrey, UK
Posts: 126
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
jonthewebb
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #3  
Old 02-27-2004, 05:38 AM
Active Member
 
Join Date: Jan 2003
Location: Surrey, UK
Posts: 126
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
jonthewebb
Default

oh yes, then obviously include() the second_categories.php in your column_left or wherever you want it.


jw
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #4  
Old 02-27-2004, 11:04 PM
Anonymous
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by jonthewebb
oh yes, then obviously include() the second_categories.php in your column_left or wherever you want it.


jw
just to test it I put the categories.php "require" in the column_left.php to see if there would be a problem - coz in essence its all I'm doing except they are both subsets of the whole catagories. right?

got this error

Fatal error: Cannot redeclare tep_show_category() in /var/www/html/blokey/catalog/includes/boxes/categories.php on line 17
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #5  
Old 02-28-2004, 01:08 AM
Active Member
 
Join Date: Jan 2003
Location: Surrey, UK
Posts: 126
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
jonthewebb
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -8. The time now is 09:27 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax