Page 5 of 9 FirstFirst ... 34567 ... LastLast
Results 41 to 50 of 83
  1. #41
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: How to hide categories with no active products

    Quote Originally Posted by mikeel100 View Post
    This does work in 1.5.3 ... please consider adding this to the next upgrade package.
    If it were to be added to the codebase, it should be an admin configurable item..
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

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

    Default Re: How to hide categories with no active products

    Why? What is the point of showing empty categories? There are already too many "configurable options" in the admin area...just sayin'

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

    Default Re: How to hide categories with no active products

    Quote Originally Posted by mikeel100 View Post
    Why? What is the point of showing empty categories? There are already too many "configurable options" in the admin area...just sayin'
    The absence of a product in a category doesn't mean that the category (and with modification all of the parent categories) is useless or doesn't provide value for the store. While generally not suggested to have a "coming soon" type display of information, I'm sure that over the years that store owners have found creative ways to use categories that do not have products for various things. As well, as pointed out the offered code only addresses the last category not having products. It doesn't address all categories between the top and that last categoy. Not that it couldn't be modified to do so, but even that additional code would be recommended to be an admin configurable option.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #44
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: How to hide categories with no active products

    Quote Originally Posted by mikeel100 View Post
    Why? What is the point of showing empty categories? There are already too many "configurable options" in the admin area...just sayin'
    Because just because YOU don't want to show empty categories doesn't mean that ALL STORES should be FORCED to have the SAME option because YOU don't agree with or understand it.. (hence WHY it should be an admin configurable option). Plus as mc12345678 pointed out this isn't a complete solution to cover ALL variables of hiding empty categories..

    As for WHY would you want empty categories??? There are MANY business reasons for this and I am NOT going to list them all and do the follow-up "back and forth" discussion on them and take this thread WAAAAAY off topic.. You may think there are too many admin options, but that simply makes Zen Cart FLEXIBLE and not some silly "one size fits all" solution. Additionally CHOICES for these options keeps novices from making core code changes they may not remember they made when upgrading their site.. Frankly I'm glad Zen Cart offers configuration options that allow you more than ONE option where it's CLEAR there should be choices.. Otherwise this forum will be filled even more with those "how can I do this?" posts.

    Quote Originally Posted by mc12345678 View Post
    The absence of a product in a category doesn't mean that the category (and with modification all of the parent categories) is useless or doesn't provide value for the store. While generally not suggested to have a "coming soon" type display of information, I'm sure that over the years that store owners have found creative ways to use categories that do not have products for various things. As well, as pointed out the offered code only addresses the last category not having products. It doesn't address all categories between the top and that last categoy. Not that it couldn't be modified to do so, but even that additional code would be recommended to be an admin configurable option.
    **nods in agreement**
    Last edited by DivaVocals; 21 Nov 2014 at 02:57 PM.
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

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

    Default Re: How to hide categories with no active products

    This is being worked into v16 as v154 is close to release and this cannot be added ...

    There are 4 files that should be addressed:
    /includes/templates/template_default/sideboxes/tpl_categories.php
    /includes/modules/category_row.php
    /includes/modules/categories_tabs.php
    /includes/classes/site_map.php

    to manage hiding the categories when either they are empty or when they only contain Products with products_status = 0 ...

    This would be controlled by an on/off switch in the Admin to allow for those who want this feature and those who do not ...

    When I have time, I will try to post the changes needed but I need to compare them to v154 vs v151 to see what the differences, if any, may be ...
    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!

  6. #46
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: How to hide categories with no active products

    Quote Originally Posted by Ajeh View Post
    This is being worked into v16 as v154 is close to release and this cannot be added ...

    There are 4 files that should be addressed:
    /includes/templates/template_default/sideboxes/tpl_categories.php
    /includes/modules/category_row.php
    /includes/modules/categories_tabs.php
    /includes/classes/site_map.php

    to manage hiding the categories when either they are empty or when they only contain Products with products_status = 0 ...

    This would be controlled by an on/off switch in the Admin to allow for those who want this feature and those who do not ...

    When I have time, I will try to post the changes needed but I need to compare them to v154 vs v151 to see what the differences, if any, may be ...
    Awesome news Ajeh!!! and kudos for making is CHOICE for shopowners.. (not a fan of "one size fits all" features) I do have a few clients who want this (hence why I subscribed to this thread to begin with) so it will be nice to see this make it's way into the core..
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

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

    Default Re: How to hide categories with no active products

    If you guys want to test this the changes are marked in RED:
    /includes/templates/template_default/sideboxes/tpl_categories.php
    Code:
        if ((CATEGORIES_PRODUCTS_INACTIVE_HIDE == 1 && $box_categories_array[$i]['count'] == 0) || 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)
           // skip empty or status off categories
        } else {
          $content .= '<a class="' . $new_style . '" 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']) {
    /includes/modules/categories_tabs.php
    Code:
      // create link to top level category
      if (CATEGORIES_PRODUCTS_INACTIVE_HIDE == 1 && zen_count_products_in_category((int)$categories_tab->fields['categories_id']) == 0) {
        // skip empty or status off categories
      } else {
        $links_list[] = '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . (int)$categories_tab->fields['categories_id']) . '">' . $categories_tab_current . '</a> ';
      }
      $categories_tab->MoveNext();
    /includes/modules/category_row.php
    Code:
        if (CATEGORIES_PRODUCTS_INACTIVE_HIDE == 1 && zen_count_products_in_category((int)$categories->fields['categories_id']) == 0) {
          // skip empty or status off categories
        } else {
    
          $list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
                                                 'text' => '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br />' . $categories->fields['categories_name'] . '</a>');
    
          $col ++;
          if ($col > (MAX_DISPLAY_CATEGORIES_PER_ROW -1)) {
            $col = 0;
            $row ++;
          }
        }
        $categories->MoveNext();
    /includes/classes/site_map.php
    Code:
          $categories = $db->Execute($categories_query);
          while (!$categories->EOF) {
            if (CATEGORIES_PRODUCTS_INACTIVE_HIDE == 1 && zen_count_products_in_category((int)$categories->fields['categories_id']) == 0) {
              // skip empty or status off categories
            } else {
              $this->data[$categories->fields['parent_id']][$categories->fields['categories_id']] = array('name' => $categories->fields['categories_name'], 'count' => 0);
            }
            $categories->MoveNext();
          }
       }
    Code:
        if (isset($this->data[$parent_id])) {
          foreach ($this->data[$parent_id] as $category_id => $category) {
            if (CATEGORIES_PRODUCTS_INACTIVE_HIDE == 1 && zen_count_products_in_category((int)$categories->fields['categories_id']) == 0) {
              // skip empty or status off categories
              continue;
            }
            $category_link = $parent_link . $category_id;
            $result .= $this->child_start_string;
            if (isset($this->data[$category_id])) {
    Then add the switch to the configuration table via the Tools ... Install SQL Patches ...
    Code:
    INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Categories with Inactive Products Status', 'CATEGORIES_PRODUCTS_INACTIVE_HIDE', '0', 'Hide Categories with Inactive Products?<br />0= off<br />1= on', 19, 30, 'zen_cfg_select_option(array(\'0\', \'1\'), ', now());
    Setting this new setting in the Configuration ... Layout Settings ... for Categories with Inactive Products Status to 0 or OFF will NOT hide the empty Categories or Categories with all Products set to products_status = 0 and setting this to 1 or ON will hide them ...
    Last edited by Ajeh; 25 Nov 2014 at 03:37 AM. Reason: FIX TYPO
    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!

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

    Default Re: How to hide categories with no active products

    It was a legitimate question...not intended to upset anyone. (DivaVocals)

    I still do not see the point of showing categories when no active products are available. It is like having an empty cookie jar on the counter...very frustrating to open it up and see nothing in it when you were expecting to.

    I was not implying that this be a ONE SIZE FITS ALL program...but I have been programming long enough to know that you can option yourself to death if you are not careful.

    I fully appreciate the flexibility of this outstanding program and the people who make it possible! That is why I have followed this program steadily since 1.3.7.

    Thanks for the code Ajeh and for appeasing everyone! You have been a tremendous help indoctrinating me into this program. Novice...maybe, but at least I am looking for ways to improve.

  9. #49
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: How to hide categories with no active products

    Quote Originally Posted by mikeel100 View Post
    It was a legitimate question...not intended to upset anyone. (DivaVocals)

    I still do not see the point of showing categories when no active products are available. It is like having an empty cookie jar on the counter...very frustrating to open it up and see nothing in it when you were expecting to.

    I was not implying that this be a ONE SIZE FITS ALL program...but I have been programming long enough to know that you can option yourself to death if you are not careful.

    I fully appreciate the flexibility of this outstanding program and the people who make it possible! That is why I have followed this program steadily since 1.3.7.

    Thanks for the code Ajeh and for appeasing everyone! You have been a tremendous help indoctrinating me into this program. Novice...maybe, but at least I am looking for ways to improve.
    Not upset.. **SMH** However IMHO this is a place where an option makes sense.. I have clients who have business reasons why they support either option.. glad Ajeh was on the case!
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

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

    Default Re: How to hide categories with no active products

    You guys are welcome ...

    While I would consider the loss of spiders not finding the Category when disabled and good Category description can help get the Products spidered ... I can also see the desire for this feature ...

    But, to each their own, hence the switch ...
    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!

 

 
Page 5 of 9 FirstFirst ... 34567 ... 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