Page 1 of 9 123 ... LastLast
Results 1 to 10 of 83
  1. #1
    Join Date
    Mar 2005
    Location
    California
    Posts
    663
    Plugin Contributions
    0

    Default How to hide categories with no active products?

    I have several categories that have zero active products. Is there some setting in Zen Cart that will automatically hide any categories that have 0 active products or will this require custom code?

    I saw a setting that says Categories with 0 Products Status, but this doesn't have any effect.

    I would disable to the categories manually, but this keeps changing depending on the items in stock, so this is very difficult.



    Thanks for any info on this.

  2. #2

    Default Re: How to hide categories with no active products

    In think that what this mod does
    http://www.zen-cart.com/index.php?ma...roducts_id=286


    Categories with 0 Products Status just hides the product count for that category so you don't have categories in three with (0)
    History does not repeat itself but it [FONT="Century Gothic"][/FONT]does rhyme - Mark Twain

  3. #3
    Join Date
    Mar 2005
    Location
    California
    Posts
    663
    Plugin Contributions
    0

    Default Re: How to hide categories with no active products

    According to the description for that mod, it seems to hide them when the customer chooses to hide them via a selection on a side box.

    I'll download that and see how the code works, maybe I can reuse code to make it work the way I want it.

  4. #4
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    383
    Plugin Contributions
    0

    Default Re: How to hide categories with no active products

    I'm in the same boat...the link above to solve this issue is for v1.3. I have version 1.5.1.

    I've been trying for weeks to figure out how to hide all subcategories where category counts are 0 of ### active. I have searched in the developers tool kit and looked in the database for anything related to category counts but have came up empty.

    I know you can click on the green/red buttons to change the categories. I'm looking for a way to automate it. I have over 7000 products in my store and it's very time consuming to manually go through each category/subcategory to find all of the categories that are 0 of ### active and deactivate them. I don't want to leave them on because that will not give the shopper a very good experience when they click on a category and nothing is there.

    I have posted this issue here http://www.zen-cart.com/showthread.p...s-are-inactive but it's not a very active feed.

    Where are category counts calculated and stored so that they will display on the admin/categories pages? That is the key I need to finish building my sql statement for taking care of this issue.

    If anyone can help, I'd appreciate it.
    Last edited by mikeel100; 7 Jul 2013 at 04:06 AM. Reason: The bg question at the bottom

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,488
    Plugin Contributions
    88

    Default Re: How to hide categories with no active products

    Did you try Configuration->Layout Settings->Categories with 0 Products Status ... and set it to 0 (off)?

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: How to hide categories with no active products

    You could customize the code, using your templates and overrides, for the file:
    /includes/templates/templates_default/sideboxes/tpl_categories.php

    and add the code in RED:
    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) or $box_categories_array[$i]['count'] == 0) {
            // skip if this is for the document box (==3)
           // skip if this category has no active products
          } else {
    See if that accomplishes what you are attempting ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #7
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    383
    Plugin Contributions
    0

    Default Re: How to hide categories with no active products

    I did try that but it has no effect.

  8. #8
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    383
    Plugin Contributions
    0

    Default Re: How to hide categories with no active products

    Quote Originally Posted by mikeel100 View Post
    I did try that but it has no effect.
    Did you try Configuration->Layout Settings->Categories with 0 Products Status ... and set it to 0 (off)?

  9. #9
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    383
    Plugin Contributions
    0

    Default Re: How to hide categories with no active products

    Quote Originally Posted by Ajeh View Post
    You could customize the code, using your templates and overrides, for the file:
    /includes/templates/templates_default/sideboxes/tpl_categories.php

    and add the code in RED:
    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) or $box_categories_array[$i]['count'] == 0) {
            // skip if this is for the document box (==3)
           // skip if this category has no active products
          } else {
    See if that accomplishes what you are attempting ...
    That made all of my categories disappear...here is the code that I modified with your suggestion.

    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) or $box_categories_array[$i]['count'] == 0) {
    // skip if this is for the document box (==3)
    // skip if this category has no active products MIKE
    } else {
    $content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
    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) or $box_categories_array[$i]['count'] == 0) {
    // skip if this is for the document box (==3)
    // skip if this category has no active products MIKE
    WHAT DO I NEED TO COMMENT OUT BELOW TO MAKE IT SKIP
    } else {
    $content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
    Last edited by mikeel100; 8 Jul 2013 at 04:23 AM. Reason: question

  10. #10
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    383
    Plugin Contributions
    0

    Default Re: How to hide categories with no active products

    Quote Originally Posted by lat9 View Post
    Did you try Configuration->Layout Settings->Categories with 0 Products Status ... and set it to 0 (off)?
    It was already set to zero...besides, that is for category counts..."Show Category Count for 0 Products?"

    Thanks though.

 

 
Page 1 of 9 123 ... LastLast

Similar Threads

  1. v150 how do i hide sub categories with no products listed
    By alibaba99 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 28 Jan 2017, 06:19 PM
  2. Hide Categories with 0 Products
    By Semenek in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 4 Sep 2010, 05:44 PM
  3. Hide categories/subcategories with no products
    By earthone in forum Basic Configuration
    Replies: 0
    Last Post: 22 Jul 2010, 09:38 PM
  4. Active products in categories box
    By ouxly40 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 26 Sep 2007, 11:46 AM
  5. How to hide sub-categories with no active products?
    By donplay in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 29 Aug 2007, 08:20 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