Results 1 to 8 of 8
  1. #1
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,296
    Plugin Contributions
    22

    Default combining all product types into one category sidebox

    So the category box code has this: $main_category_tree->zen_category_tree();
    The documents category box has this: $main_category_tree->zen_category_tree(3);

    The category tree states
    PHP Code:
    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, c.categories_image
                                 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"

    But if I change the categories box code from this $main_category_tree->zen_category_tree(); to this $main_category_tree->zen_category_tree(all); the documents category still does not show in the sidebox.

    Then I tried zen_category_tree($product_type = "all") as well. No dice. So how do I get all product types to show in the categories box? I get the feeling this is simple....
    The full-time Zen Cart Guru. WizTech4ZC.com

  2. #2
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,296
    Plugin Contributions
    22

    Default Re: combining all product types into one category sidebox

    Uh, the category tabs? Yay!
    The full-time Zen Cart Guru. WizTech4ZC.com

  3. #3
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: combining all product types into one category sidebox

    It would appear from the above, that the following was not tried:
    Code:
    $main_category_tree->zen_category_tree('all');
    With some sort of quote around the text string 'all'.

    Or just use an empty paretheses grouping and it will default to 'all'.
    Last edited by mc12345678; 16 Jul 2019 at 02:04 PM.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,296
    Plugin Contributions
    22

    Default Re: combining all product types into one category sidebox

    nope I did try that and it did not work. Does look to me it should work.

    The category tabs module does it in a more complicated fashion and it works. Ah, if it were all so straightforward as just a query!
    The full-time Zen Cart Guru. WizTech4ZC.com

  5. #5
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: combining all product types into one category sidebox

    The "issue" is that in at least the template_default version:
    includes/templates/template_default/sideboxes/tpl_categories.php there is a section of code that specifically prevents the display of document type product attributing their display to the document sidebox.

    Code:
         if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
            // skip if this is for the document box (==3)
    If you change to:
    Code:
         if (false && zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
            // skip if this is for the document box (==3)
    By anding 'false' to the check against category being 3 (document) then the section below that should apply, though there may be some other issue to address if the expected/necessary data is not available/populated. I hadn't looked beyond this tid bit.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,296
    Plugin Contributions
    22

    Default Re: combining all product types into one category sidebox

    oh perfect! Thanks for working with me on this. My coding skills have atrophied over the past few years and I'm now learning and refreshing so bear with me.

    Now I want an admin setting to trigger it! My first attempt did nothing, not surprisingly. The config key is ALL_CATEGORIES and true or false unless you have a better suggestion.
    The full-time Zen Cart Guru. WizTech4ZC.com

  7. #7
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,296
    Plugin Contributions
    22

    Default Re: combining all product types into one category sidebox

    ah, removing the first part of the if/else statement is the straightforward way to create this without an admin setting

    PHP Code:
    // if (false && $ALL_CATEGORIES == 'false'  && zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
            // skip if this is for the document box (==3)
         // } else {
          
    $content .= '<li class="' $new_style '"><a  href="' zen_href_link(FILENAME_DEFAULT$box_categories_array[$i]['path']) . '">';

          if (
    $box_categories_array[$i]['current']) {
            if (
    $box_categories_array[$i]['has_sub_cat']) {
              
    $content .= '<span class="category-subs-parent">' $box_categories_array[$i]['name'] . '</span>';
            } else {
              
    $content .= '<span class="category-subs-selected">' $box_categories_array[$i]['name'] . '</span>';
            }
          } else {
            
    $content .= $box_categories_array[$i]['name'];
          }

          if (
    $box_categories_array[$i]['has_sub_cat']) {
            
    $content .= CATEGORIES_SEPARATOR;
          }
          
    $content .= '</a>';

          if (
    SHOW_COUNTS == 'true') {
            if ((
    CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) {
              
    $content .= CATEGORIES_COUNT_PREFIX $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX;
            }
          }

          
    $content .= '</li>' "\n";
      
    //  } 
    The full-time Zen Cart Guru. WizTech4ZC.com

  8. #8
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: combining all product types into one category sidebox

    Yeah, so is just adding a false into the line, but whatever works at least to support showing the products assigned to product type 3. Now though, the admin control to hide sub-categories while on a sub-category no longer responds. It would appear that the admin configuration: SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS was not set to true (1) and that the category viewed was a sub-category. The setting for that constant which appears to be used only in the categories sidebox is:
    Title: Categories - Always Open to Show SubCategories
    Description: Always Show Categories and SubCategories
    0= off, just show Top Categories
    1= on, Always show Categories and SubCategories when selected
    Value: 1
    Group: ID#19 Layout Settings

    Where Value of 1 is the default value on install.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. Replies: 2
    Last Post: 4 Oct 2013, 11:51 AM
  2. I like to sort one product into more than one category
    By soso838 in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 5 Jun 2012, 05:31 PM
  3. v139h How to group all specials into one category and shows up in menu? Thanks.
    By mdivk in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 23 Apr 2012, 10:44 PM
  4. css- combining into one sheet
    By PinkLeopard in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 27 Dec 2009, 05:54 PM
  5. Disable Category Sidebox on all but one ezpage
    By CyberWoolf in forum Basic Configuration
    Replies: 6
    Last Post: 18 Mar 2009, 02:44 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR