Page 1 of 3 123 LastLast
Results 1 to 10 of 27
  1. #1
    Join Date
    Dec 2007
    Posts
    9
    Plugin Contributions
    0

    Default Hiding Categories

    Am new to using the software have everything set up and looking great. Just a quick question that I couldnt seem to find an answer to. Can you hide categories/ subcategories when they dont have any stock or product listed in them?
    Just want to save my customers following those links until such time as I upload stock to them.
    Thanks
    Ally

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Hiding Categories

    Try in the admin > config > stock > Products status in Catalog when out of stock should be set to > 0= set product status to OFF

  3. #3
    Join Date
    Dec 2007
    Posts
    9
    Plugin Contributions
    0

    Default Re: Hiding Categories

    Thanks for your help will try that

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

    Default Re: Hiding Categories

    Unfortunately that won't hide the category when it is empty. You can manually disable any category that doesn't have products ready for sale, in Catalog > Categories/Products. Click on the green button next to the category in the list (under Status) and it will turn red.

  5. #5
    Join Date
    Mar 2007
    Location
    Deep in the Black Country, UK
    Posts
    34
    Plugin Contributions
    0

    Default Re: Hiding Categories

    Is there some sql I could paste which would disable empty categories rather than ploughing through them all manually?
    I have a site populated with 16000 products in an industry standard category structure. There are unused categories which I have managed to hide in the categories sidebox using the categories dressing mod but there is a category list at the top of the page which still has them and also subcategories displayed on the main page show them so I think it would be better to disable the empty ones rather than 'not display' them - set their status to 0.
    With 16000 products and 1500 categories that is a mammoth task and Im sure there is an 'automatic' way to do this with an sql statement but Im not familiar enough with sql to come up with it myself

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

    Default Re: Hiding Categories

    For a start, /includes/functions/functions_categories.php should have a function to count the products in a category. From there, you could loop through the categories and apply SQL to reset the status of each cat without products. Someone should be able to come up with the SQL statement for the resetting.

  7. #7
    Join Date
    Mar 2007
    Location
    Deep in the Black Country, UK
    Posts
    34
    Plugin Contributions
    0

    Default Re: Hiding Categories

    I noticed the count is shown in the admin side aswell. It could probably be used to perform the same function as clicking the icon, without the confirmation page. Thats as far as I got before I became expertiseless tho!

  8. #8
    Join Date
    Dec 2008
    Posts
    1
    Plugin Contributions
    0

    Have a Drink Re: Hiding Categories

    Quote Originally Posted by gjh42 View Post
    For a start, /includes/functions/functions_categories.php should have a function to count the products in a category. From there, you could loop through the categories and apply SQL to reset the status of each cat without products. Someone should be able to come up with the SQL statement for the resetting.
    Somebody could give this SQL statement? TIA!

  9. #9
    Join Date
    Mar 2009
    Posts
    1
    Plugin Contributions
    0

    Default Re: Hiding Categories

    Sorry for the late reply, but I just found this thread when looking for the same thing. I didn't find the answer so I came up with these queries.
    To hide:
    To delete:
    Use at own risk, dosen't work just yet.

    Regards!
    Sven ,Sweden
    -Noob Carter-
    Last edited by Zwempha; 16 May 2009 at 11:45 AM. Reason: Posting to soon without testing thoroughly

  10. #10
    Join Date
    Aug 2009
    Posts
    38
    Plugin Contributions
    0

    Default Re: Hiding Categories

    Here is a query that will return a list of categories that have active products and 4 levels above that those categories are subs to - how you choose to use it is your business. In other words, if you use it to delete categories that you later find should not have been, I am not responsible.

    At this stage it only handles 5 levels - but it could go farther if needed. I have tested this in MySQL and it tolerates the nested sub-selects. Using an ODBC connection I found that MS Access does not.

    Code:
    SELECT categories_id FROM zen_products_to_categories
    WHERE products_id IN (SELECT products_id FROM zen_products WHERE products_status = 1)
    UNION
    SELECT zen_categories.parent_id FROM zen_categories 
    WHERE zen_categories.categories_id In (SELECT categories_id FROM zen_products_to_categories)
    UNION
    SELECT parent_id FROM zen_categories 
    WHERE categories_id IN( SELECT zen_categories.parent_id FROM zen_categories WHERE zen_categories.categories_id In (SELECT categories_id FROM zen_products_to_categories))
    UNION
    SELECT parent_id FROM zen_categories 
    WHERE categories_id IN (SELECT parent_id FROM zen_categories 
    WHERE categories_id IN( SELECT zen_categories.parent_id FROM zen_categories WHERE zen_categories.categories_id In (SELECT categories_id FROM zen_products_to_categories)))
    UNION
    SELECT parent_id FROM zen_categories
    WHERE categories_id IN (
    SELECT parent_id FROM zen_categories 
    WHERE categories_id IN (SELECT parent_id FROM zen_categories 
    WHERE categories_id IN( SELECT zen_categories.parent_id FROM zen_categories WHERE zen_categories.categories_id In (SELECT categories_id FROM zen_products_to_categories))))
    ORDER BY categories_id
    Good luck and ALWAYS backup your database!

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. hiding categories
    By ian healy in forum General Questions
    Replies: 2
    Last Post: 28 Apr 2008, 04:44 AM
  2. Hiding the top categories
    By maclancer in forum General Questions
    Replies: 0
    Last Post: 23 Jul 2007, 11:35 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