osCmax v2.5 User Manual
Results 1 to 5 of 5

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

      
  1. #1
    Active Member
    Join Date
    Aug 2003
    Posts
    119
    Rep Power
    0


    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?

  2. #2
    Active Member
    Join Date
    Jan 2003
    Location
    Surrey, UK
    Posts
    126
    Rep Power
    0


    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

  3. #3
    Active Member
    Join Date
    Jan 2003
    Location
    Surrey, UK
    Posts
    126
    Rep Power
    0


    Default

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


    jw

  4. #4
    Anonymous
    Guest


    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

  5. #5
    Active Member
    Join Date
    Jan 2003
    Location
    Surrey, UK
    Posts
    126
    Rep Power
    0


    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

Similar Threads

  1. Adding Category Descriptions in Category List for each Cat.
    By el1jones in forum osCmax v2 Customization/Mods
    Replies: 1
    Last Post: 03-15-2006, 12:37 AM
  2. Remove certain boxes from specific category
    By auntie22 in forum osCmax v1.7 Discussion
    Replies: 1
    Last Post: 10-25-2005, 06:39 PM
  3. change boxes background color now have double boxes
    By ANNIE11 in forum osCMax v1.7 General Mods Discussion
    Replies: 0
    Last Post: 08-22-2005, 07:16 PM
  4. New category does not create new category folder
    By Anonymous in forum osCommerce 2.2 Installation Help
    Replies: 3
    Last Post: 02-23-2003, 11:52 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •