Page 7 of 7 FirstFirst ... 567
Results 61 to 70 of 70
  1. #61
    Join Date
    May 2008
    Posts
    26
    Plugin Contributions
    0

    Default Re: Parent Categories Separated In 3 sideboxes

    The scenario is three top categories, in three boxes, showing only their subcategories, all the time. The boxes should be the same on whatever page you're looking at.

    I have cloned one box, and was planning to make one that worked right that I could clone for the others.

    I see what you mean about the substr_count( bit... I understood what it was doing, but didn't put two and two together (literally) that it was a redundant operation.

    I do not have an expanded cats mod... I read that portion of the discussion several times, but somehow came to the conclusion that this would work without it. It seems I was wrong here

    yellow1912's link seems to be unavailable at the moment, it sounds closer to what I'm trying to do. Is there another source of that mod?

    thanks for your help

  2. #62
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Parent Categories Separated In 3 sideboxes

    I don't believe yellow1912's mods are available anywhere but on his site, unless someone has a copy they can send you. I have a copy, though I'm not sure it is the latest version, and will zip & send it if you want.

  3. #63
    Join Date
    Dec 2008
    Posts
    3
    Plugin Contributions
    0

    Idea or Suggestion Re: Parent Categories Separated In 3 sideboxes

    hi i am after some help please, i have been working on making 3 separated cat boxes as explained by webomat very detialed but i am having problems i keep getting phase errors im sure this is becauce im copying the function incorectly would any one be able to show me where the functions needs to be pasted in sorry but my php is very limited i need to duplicate the function "zen_category_tree" and rename the new function to "zen_clear_tree", ive managed to get everything else working ie additional side box showing all categories on the main page i have attached my file below if anyone could help it would be very much appriciated ive been racking my brain for the last 7 hours with no luck, a donation wouldnt be a problem


    // $Id: category_tree.php 290 2004-09-15 19:48:26Z wilt $
    //

    class category_tree {

    function zen_category_tree($product_type = "all") {
    global $db, $cPath, $cPath_array;
    if ($product_type != 'all') {
    $sql = "select type_master_type from " . TABLE_PRODUCT_TYPES . "
    where type_master_type = '" . $product_type . "'";
    $master_type_result = $db->Execute($sql);
    $master_type = $master_type_result->fields['type_master_type'];
    }
    $this->tree = array();
    if ($product_type == 'all') {
    $categories_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)$_SESSION['languages_id'] . "'
    and c.categories_status= '1'
    order by sort_order, cd.categories_name";
    } else {
    $categories_query = "select ptc.category_id as categories_id, cd.categories_name, c.parent_id
    from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_PRODUCT_TYPES_TO_CATEGORY . " ptc
    where c.parent_id = '0'
    and ptc.category_id = cd.categories_id
    and ptc.product_type_id = '" . $master_type . "'
    and c.categories_id = ptc.category_id
    and cd.language_id='" . (int)$_SESSION['languages_id'] ."'
    and c.categories_status= '1'
    order by sort_order, cd.categories_name";
    }
    $categories = $db->Execute($categories_query, '', true, 150);
    while (!$categories->EOF) {
    $this->tree[$categories->fields['categories_id']] = array('name' => $categories->fields['categories_name'],
    'parent' => $categories->fields['parent_id'],
    'level' => 0,
    'path' => $categories->fields['categories_id'],
    'next_id' => false);

    if (isset($parent_id)) {
    $this->tree[$parent_id]['next_id'] = $categories->fields['categories_id'];
    }

    $parent_id = $categories->fields['categories_id'];

    if (!isset($first_element)) {
    $first_element = $categories->fields['categories_id'];
    }
    $categories->MoveNext();
    }
    if (zen_not_null($cPath)) {
    $new_path = '';
    reset($cPath_array);
    while (list($key, $value) = each($cPath_array)) {
    unset($parent_id);
    unset($first_id);
    if ($product_type == 'all') {
    $categories_query = "select c.categories_id, cd.categories_name, c.parent_id
    from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
    where c.parent_id = '" . (int)$value . "'
    and c.categories_id = cd.categories_id
    and cd.language_id='" . (int)$_SESSION['languages_id'] . "'
    and c.categories_status= '1'
    order by sort_order, cd.categories_name";
    } else {
    /*
    $categories_query = "select ptc.category_id as categories, cd.categories_name, c.parent_id
    from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_PRODUCT_TYPES_TO_CATEGORY . " ptc
    where c.parent_id = '" . (int)$value . "'
    and ptc.category_id = cd.categories_id
    and ptc.product_type_id = '" . $master_type . "'
    and cd.language_id='" . (int)$_SESSION['languages_id'] . "'
    and c.categories_status= '1'
    order by sort_order, cd.categories_name";
    */
    $categories_query = "select ptc.category_id as categories_id, cd.categories_name, c.parent_id
    from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_PRODUCT_TYPES_TO_CATEGORY . " ptc
    where c.parent_id = '" . (int)$value . "'
    and ptc.category_id = cd.categories_id
    and ptc.product_type_id = '" . $master_type . "'
    and c.categories_id = ptc.category_id
    and cd.language_id='" . (int)$_SESSION['languages_id'] ."'
    and c.categories_status= '1'
    order by sort_order, cd.categories_name";

    }

    $rows = $db->Execute($categories_query);

    if ($rows->RecordCount()>0) {
    $new_path .= $value;
    while (!$rows->EOF) {
    $this->tree[$rows->fields['categories_id']] = array('name' => $rows->fields['categories_name'],
    'parent' => $rows->fields['parent_id'],
    'level' => $key+1,
    'path' => $new_path . '_' . $rows->fields['categories_id'],
    'next_id' => false);

    if (isset($parent_id)) {
    $this->tree[$parent_id]['next_id'] = $rows->fields['categories_id'];
    }

    $parent_id = $rows->fields['categories_id'];
    if (!isset($first_id)) {
    $first_id = $rows->fields['categories_id'];
    }

    $last_id = $rows->fields['categories_id'];
    $rows->MoveNext();
    }
    $this->tree[$last_id]['next_id'] = $this->tree[$value]['next_id'];
    $this->tree[$value]['next_id'] = $first_id;
    $new_path .= '_';
    } else {
    break;
    }
    }
    }
    $row = 0;
    return $this->zen_show_category($first_element, $row);
    }

    function zen_show_category($counter,$ii) {
    global $cPath_array;

    $this->categories_string = "";

    for ($i=0; $i<$this->tree[$counter]['level']; $i++) {
    if ($this->tree[$counter]['parent'] != 0) {
    $this->categories_string .= CATEGORIES_SUBCATEGORIES_INDENT;
    }
    }


    if ($this->tree[$counter]['parent'] == 0) {
    $cPath_new = 'cPath=' . $counter;
    $this->box_categories_array[$ii]['top'] = 'true';
    } else {
    $this->box_categories_array[$ii]['top'] = 'false';
    $cPath_new = 'cPath=' . $this->tree[$counter]['path'];
    $this->categories_string .= CATEGORIES_SEPARATOR_SUBS;
    }
    $this->box_categories_array[$ii]['path'] = $cPath_new;

    if (isset($cPath_array) && in_array($counter, $cPath_array)) {
    $this->box_categories_array[$ii]['current'] = true;
    }

    // display category name
    $this->box_categories_array[$ii]['name'] = $this->categories_string . $this->tree[$counter]['name'];


    if (zen_has_category_subcategories($counter)) {
    $this->box_categories_array[$ii]['has_sub_cat'] = true;
    }

    if (SHOW_COUNTS == 'true') {
    $products_in_category = zen_count_products_in_category($counter);
    if ($products_in_category > 0) {
    $this->box_categories_array[$ii]['count'] = $products_in_category;
    }
    }

    if ($this->tree[$counter]['next_id'] != false) {
    $ii++;
    $this->zen_show_category($this->tree[$counter]['next_id'], $ii);
    }
    return $this->box_categories_array;
    }
    }
    ?>

  4. #64
    Join Date
    Dec 2008
    Posts
    3
    Plugin Contributions
    0

    Default Re: Parent Categories Separated In 3 sideboxes



    hi everyone ive manged to get my problem sorted so everyone nos i used the blank side box download then added links to the relevent cats and duplicate the new side boxes with amendments, although this wont update in admin it seems to work fine if anyone needs help setting this up please message me

  5. #65
    Join Date
    Jan 2009
    Location
    Vegas Baby!
    Posts
    332
    Plugin Contributions
    0

    Default Re: Parent Categories Separated In 3 sideboxes

    I am trying to follow all of this but I'm a bit confused about what exactly needs to be done to: show separate sideboxes for each category with subcategories always showing, like I have here.

    Is this correct?

    Clone categories sidebox for each category that I want, then follow instructions in Glenn's post #41

    Or did I miss something?

    It would be great if someone would made this into a mod, like More Category Boxes for Osc. And by the way, would any of that code work for Zen Cart????

  6. #66
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Parent Categories Separated In 3 sideboxes

    I had thought about making up this mod, but with v2.0 just around the corner, I don't feel like making the substantial investment of time now for something that will have to be redone from scratch for the new version.

    And no, the osC code will likely not be useful at all.

  7. #67
    Join Date
    Jan 2009
    Location
    Vegas Baby!
    Posts
    332
    Plugin Contributions
    0

    Default Re: Parent Categories Separated In 3 sideboxes

    Quote Originally Posted by gjh42 View Post
    I had thought about making up this mod, but with v2.0 just around the corner, I don't feel like making the substantial investment of time now for something that will have to be redone from scratch for the new version.

    And no, the osC code will likely not be useful at all.
    Ah, didn't know there was new version coming out.

    So, does post 41 contain the correct code to use?

    What I've done so far is use Blank Sideboxes to create a new sidebox for each parent category that I want. I have hardcoded the links for now, but I'd rather just have them created automatically...I think --

    If I change the categories around, I have to change the links in the pages. But I would have the change the code too, so I guess I don't really need to do anything...unless I'm missing something I should be thinking of...

  8. #68
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Parent Categories Separated In 3 sideboxes

    Yes, the post 41 code should work for cloned categories sideboxes, to display only topcats listed in the explode and their subcats.

  9. #69
    Join Date
    Jan 2009
    Location
    Vegas Baby!
    Posts
    332
    Plugin Contributions
    0

    Default Re: Parent Categories Separated In 3 sideboxes

    Quote Originally Posted by gjh42 View Post
    Yes, the post 41 code should work for cloned categories sideboxes, to display only topcats listed in the explode and their subcats.
    Thanks, Glenn!

  10. #70
    Join Date
    May 2007
    Location
    Italy
    Posts
    438
    Plugin Contributions
    0

    Default Re: Parent Categories Separated In 3 sideboxes

    I hope this is the right post

    Hello, I have the 1.3.8a and I have to add 3 sideboxes.
    I have a store of toys

    I would to add
    - 1 box on the left under categories, with the links at the producer, so for example Mattel, and if I click on Mattel it shows all Mattel products.

    - 1 box on right on which insert link with boy and girl so when I click on girl I see all products for girl
    -1 box on right on which insert the different ages

    how can I do?
    and to have the selector by age or genre (boy or girl) I have to add options or attributes before?

    Thank you very much


    In next version 2.0 it will be implemented this mod or at the start it will not be?

 

 
Page 7 of 7 FirstFirst ... 567

Similar Threads

  1. Category Filter - Display Parent categories
    By djdavedawson in forum General Questions
    Replies: 1
    Last Post: 5 Oct 2010, 10:08 PM
  2. Subcategories products in Parent Categories
    By fightthefourwalls in forum Setting Up Categories, Products, Attributes
    Replies: 21
    Last Post: 14 Jun 2010, 07:58 PM
  3. Enable Links for Parent Categories in Categories Sidebox
    By MrsQ in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 11 Sep 2009, 08:25 PM
  4. Parent... Child... Sub.... CATEGORIES
    By eliza-bee in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 12 May 2009, 03:03 PM
  5. Parent categories in dropdown filter
    By Ben in forum Customization from the Admin
    Replies: 3
    Last Post: 15 Aug 2006, 02:38 PM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR