Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12
  1. #11
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,238
    Plugin Contributions
    1

    Default Re: How to hide empty categories automatically?

    Quote Originally Posted by IATIA View Post
    Works great on ver 1.5.6a
    And on ZC v1.5.6c

    I've spent a while trying to also hide empty categories in my menu that uses the 'categories_ul_generator' class, this code:

    PHP Code:
    require_once (DIR_WS_CLASSES 'categories_ul_generator.php');
    $zen_CategoriesUL = new zen_categories_ul_generator;
    $menulist $zen_CategoriesUL->buildTree(true);
    $menulist str_replace('"level4"','"level5"',$menulist);
    $menulist str_replace('"level3"','"level4"',$menulist);
    $menulist str_replace('"level2"','"level3"',$menulist);
    $menulist str_replace('"level1"','"level2"',$menulist);
    $menulist str_replace('<li>','<li>',$menulist);
    $menulist str_replace("</li>\n</ul>\n</li>\n</ul>\n","</li>\n</ul>\n",$menulist);
    echo 
    $menulist;} 
    Thought I would post the solution:

    /includes/classes/categories_ul_generator.php
    Code:
    $categories = $db->Execute($categories_query);
             while (!$categories->EOF) {
    			// skip empty or status off categories
    			if (!(CATEGORIES_PRODUCTS_INACTIVE_HIDE == 1 && zen_count_products_in_category((int)$categories->fields['categories_id']) == 0)) {
                $this->data[$categories->fields['parent_id']][$categories->fields['categories_id']] = array('name' => $categories->fields['categories_name'], 'count' => 0);
    			}
                $categories->MoveNext();
            }
    Simon

  2. #12
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,238
    Plugin Contributions
    1

    Default Re: How to hide empty categories automatically?

    I was going off Ajeh's /includes/classes/site_map.php as a guide - it looks as though there might be an additional change needed in categories_ul_generator.php, looking in to it.
    Simon

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v151 URI Mapping - How do I automatically add mappings for EXISTING Categories/Products?
    By Adrian Ciocîrlan in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 8 Jun 2016, 02:14 PM
  2. v139h How to automatically turn off sold out categories
    By joew36 in forum General Questions
    Replies: 4
    Last Post: 24 Jul 2015, 01:17 PM
  3. Replies: 10
    Last Post: 3 Oct 2013, 03:43 PM
  4. How to hide ampty categories
    By marknew in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 24 Jan 2011, 03:36 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