Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18
  1. #11
    Join Date
    Apr 2013
    Location
    United Kingdom
    Posts
    11
    Plugin Contributions
    0

    Default Re: Not all subcategories appearing in sidebox

    Quote Originally Posted by stevesh View Post
    What's the category id number for Occasions - Birthdays - Her ? What happens if you temporarily switch back to the Classic template ?
    Category ID Occasions (66) > Birthdays (67) > Her (80)

    I just switched back to classic green and the sidebox shows correctly but switched back to custom and it goes again, just for info I am using the "estorenow" template.

    Thanks for you input :)

  2. #12
    Join Date
    Apr 2013
    Location
    United Kingdom
    Posts
    11
    Plugin Contributions
    0

    Default Re: Not all subcategories appearing in sidebox

    Ok so I've subbed the tpl_categories.php file with the original from classic and the categories work albeit not cosmetically formatted.

    This is the code from the tpl_categories.php from the "estorenow" template, I'm not familiar enough with PHP to see what if anything is wrong here, would someone be kind enough to look over this please?

    <?php
    /**
    * Side Box Template
    *
    * @package templateSystem
    * @copyright Copyright 2003-2006 Zen Cart Development Team
    * @copyright Portions Copyright 2003 osCommerce
    * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
    * @version $Id: tpl_categories.php 4162 2006-08-17 03:55:02Z ajeh $
    */
    $content = "";

    $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent"><ul id="cat">' ;
    $ul_close='YES';//YES NO

    for ($i=0;$i<sizeof($box_categories_array);$i++) {

    switch(true) {
    // to make a specific category stand out define a new class in the stylesheet example: A.category-holiday
    // uncomment the select below and set the cPath=3 to the cPath= your_categories_id
    // many variations of this can be done
    // case ($box_categories_array[$i]['path'] == 'cPath=3'):
    // $new_style = 'category-holiday';
    // break;
    case ($box_categories_array[$i]['top'] == 'true'):
    $new_style = 'category-top';
    break;
    case ($box_categories_array[$i]['has_sub_cat']):
    $new_style = 'category-subs';
    break;
    default:
    $new_style = 'category-products';
    }

    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)
    } else {
    /////////////////////////////1.1/////////////////////////
    if($box_categories_array[$i]['has_sub_cat'] && $new_style == 'category-top' ){

    if($ul_close=='NO'){
    $content =$content.'</ul></li>';
    $ul_close='YES';
    }
    $ul_close='NO';
    $content .= '<li><a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
    $content .= $box_categories_array[$i]['name'];

    $content =$content.'</a><ul>';
    }//new addon for <li>
    /////////////////1.2///////////////////////////////
    elseif($box_categories_array[$i]['has_sub_cat']==false&&$new_style == 'category-products'){// for child
    $content .= '<li><a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
    $content .= $box_categories_array[$i]['name'];
    $content =$content.'</a></li>';
    if($i==(sizeof($box_categories_array)-1)){//last li ele


    $content =$content.'</ul></li>';

    }
    //////////////////1.3/////////////////
    }elseif($box_categories_array[$i]['has_sub_cat']==false&&$new_style == 'category-top'){
    if($ul_close=='NO'){

    $content =$content.'</ul></li>';
    $ul_close='YES';
    }

    $content .= '<li><a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';

    $content .= $box_categories_array[$i]['name'];

    $content =$content.'</a></li>';

    ////////////////////////////
    if (false) {//display counts
    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;

    }

    }
    }
    //eof new adds on
    }//end of else
    }//eof for loop
    ///////////////////////////////////////////////////////////////////////////////////////////
    if (SHOW_CATEGORIES_BOX_SPECIALS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true' or SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
    // display a separator between categories and links

    if (SHOW_CATEGORIES_BOX_SPECIALS == 'true') {//display specials
    $show_this = $db->Execute("select s.products_id from " . TABLE_SPECIALS . " s where s.status= 1 limit 1");
    if ($show_this->RecordCount() > 0) {
    $content .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_SPECIALS) . '">' . CATEGORIES_BOX_HEADING_SPECIALS . '</a></li>';
    }
    }
    if (SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true') {//displal new products
    // display limits
    // $display_limit = zen_get_products_new_timelimit();
    $display_limit = zen_get_new_date_range();

    $show_this = $db->Execute("select p.products_id
    from " . TABLE_PRODUCTS . " p
    where p.products_status = 1 " . $display_limit . " limit 1");
    if ($show_this->RecordCount() > 0) {
    $content .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_NEW) . '">' . CATEGORIES_BOX_HEADING_WHATS_NEW . '</a></li>' ;
    }
    }
    if (SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true') {//display featured products
    $show_this = $db->Execute("select products_id from " . TABLE_FEATURED . " where status= 1 limit 1");
    if ($show_this->RecordCount() > 0) {
    $content .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . CATEGORIES_BOX_HEADING_FEATURED_PRODUCTS . '</a></li>';
    }
    }
    if (SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
    $content .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_ALL) . '">' . CATEGORIES_BOX_HEADING_PRODUCTS_ALL . '</a></li>';
    }
    }
    $content .= '</ul></div>';
    ?>
    Last edited by CHRI55YB0Y; 14 Apr 2013 at 10:06 PM. Reason: posted in red

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

    Default Re: Not all subcategories appearing in sidebox

    This is not the only file causing the error (though it is outputting the error). It can be really hard to debug program logic flow by looking at a file without running it, but I notice that all of the subcats and sub-subcats have a .category-products class assigned where some should have .category-subs.

    There is some incomplete logic in this file. It only allows for top cats with subcats, top cats without subs, or subcats without subs. Subcats with subcats will not be handled by that part of the code and will not be output at all (when I go to cPath=66_67_80 I do see Occasions > Her listed as a sub-subcat, but not Birthdays as the parent of Her).

    A previous file in the stream is not assigning the correct value to $box_categories_array[$i]['has_sub_cat'], thus subcats with subcats are ignored by the sidebox. The two errors compound each other. I find it hard to imagine such an erroneous result being overlooked by all previous people who have used the template, but anything is possible...

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

    Default Re: Not all subcategories appearing in sidebox

    Okay, correction to the logic flow...
    Maybe the subcats with subcats are being assigned the correct class tag, but as the code ignores these subcats for output, we can't know without some debug code added.

    The first thing to do would be to add the missing logic to handle subcats with subcats. Something like (find this)
    PHP Code:
    // skip if this is for the document box (==3)
    } else {
    /////////////////////////////1.1/////////////////////////
    if($box_categories_array[$i]['has_sub_cat'] && $new_style == 'category-top' ){

    if(
    $ul_close=='NO'){
    $content =$content.'</ul></li>';
    $ul_close='YES';
    }
    $ul_close='NO';
    $content .= '<li><a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT$box_categories_array[$i]['path']) . '">';
    $content .= $box_categories_array[$i]['name'];

    $content =$content.'</a><ul>';
    }
    //new addon for <li>
    /////////////////1.2/////////////////////////////// 
    add another section after this one:
    PHP Code:
    // skip if this is for the document box (==3)
    } else {
    /////////////////////////////1.1/////////////////////////
    if($box_categories_array[$i]['has_sub_cat'] && $new_style == 'category-top' ){

    if(
    $ul_close=='NO'){
      
    $content =$content.'</ul></li>';
      
    $ul_close='YES';
    }
    $ul_close='NO';
    $content .= '<li><a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT$box_categories_array[$i]['path']) . '">';
    $content .= $box_categories_array[$i]['name'];

    $content =$content.'</a><ul>';
    }
    //new addon for <li>
    ///////////1.1a/////////////////
     
    elseif($new_style == 'category-subs' ){//subcat with subcats

    //if($ul_close=='NO'){//not sure how this section should work yet, need to study it more
      //$content =$content.'</ul></li>';
      //$ul_close='YES';
    //}
    $ul_close='NO';
    $content .= '<li><a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT$box_categories_array[$i]['path']) . '">';
    $content .= $box_categories_array[$i]['name'];

    $content .= '</a><ul>';
    }
    //new addon for <li>
    /////////////////1.2///////////////////////////////
    elseif($box_categories_array[$i]['has_sub_cat']==false&&$new_style == 'category-products'){// for child 

  5. #15
    Join Date
    Apr 2013
    Location
    United Kingdom
    Posts
    11
    Plugin Contributions
    0

    Default Re: Not all subcategories appearing in sidebox

    Thanks for taking the time to look I really appreciate it.

    I will try your suggestion when I get home tonight.

    Thanks again

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

    Default Re: Not all subcategories appearing in sidebox

    If you find that this fixes it, you should really report the bug and the solution to the template source. If it doesn't fix it, report the bug, as it is the author's responsibility to make it work correctly.

  7. #17
    Join Date
    Apr 2013
    Location
    United Kingdom
    Posts
    11
    Plugin Contributions
    0

    Default Re: Not all subcategories appearing in sidebox

    Quote Originally Posted by gjh42 View Post
    If you find that this fixes it, you should really report the bug and the solution to the template source. If it doesn't fix it, report the bug, as it is the author's responsibility to make it work correctly.
    OK, do I do that through the template section of this site (It was downloaded from Zen site)? surprised it's not been spotted before I can't be the only person doing more than one sub cat

    Anyhow, I've taken your amendments and added as you suggested which didn't fix to start with, so as per below code I've uncommented a section and it now appears correctly on the site. The only issue I have now though is alignment, I've added a ".category-subs" to my css sheet which has provisionally put arr.gif in front the category. But as you can see "Birthdays" is now a few pixels left of the other sub categories, is this purely finding the right tag in the css file?

    Thanks again, appreciate your time

    PHP Code:
     ////////////////1.1a////////////////
          
    elseif( $new_style == 'category-subs' ){//subcat with subcats
          
    if($ul_close=='NO'){//not sure how this section should work yet, need to study it more
      
    $content =$content.'</ul></li>';
      
    $ul_close='YES';
    }
    $ul_close='NO';
    $content .= '<li><a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT$box_categories_array[$i]['path']) . '">';
    $content .= $box_categories_array[$i]['name'];

    $content .= '</a><ul>'

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

    Default Re: Not all subcategories appearing in sidebox

    This display reveals another aspect of the incompleteness of the <ul> handling of this menu: When the sub-subcats end and a new top cat is displayed, it needs to close two levels of <ul>, but it only is able to close one, so all of the following items are inside the first top category's list. It needs to keep track of the nesting level of lists so that it can format them correctly. I spent a lot of time getting this right for Categories Dressing, with much more complex possibilities than this mod presents, and don't want to reinvent it now.

    At any rate, you can find the author's name and/or contact info in the mod's readme documentation somewhere, and I would suggest sending them to this thread to see the whole issue.

    Meanwhile, if you want to have a fully and correctly functioning menu with distinctions between levels and kinds of categories, you could install Categories Dressing. It has numerous features which you would probably need to turn off, but you can do about anything you can imagine with the categories sidebox using it. It would obviously need restyling to become consistent with what you have; post in the Categories Dressing support thread if you need help with that.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v139h Manufacture left sidebox not appearing
    By cabdr1ver in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 29 Feb 2012, 05:08 PM
  2. Subcategories in sidebox not showing
    By boomy in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 16 Aug 2011, 08:49 AM
  3. category image not appearing for all categories
    By ccdca710 in forum Setting Up Categories, Products, Attributes
    Replies: 19
    Last Post: 15 Feb 2010, 08:10 AM
  4. Blank Sidebox not appearing
    By chufty bill in forum Addon Sideboxes
    Replies: 3
    Last Post: 21 Oct 2006, 11:53 AM

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