Forums / General Questions / Automatic or sql to turn off subcategories and sub-subcategories with 0 active items

Automatic or sql to turn off subcategories and sub-subcategories with 0 active items

Views: 1,633

Results 1 to 12 of 12
3 Feb 2015, 3:27 PM
#1
stxmona avatar

stxmona

Zen Follower

Join Date:
Aug 2008
Posts:
103
Plugin Contributions:
0

Automatic or sql to turn off subcategories and sub-subcategories with 0 active items

Hello
I was wondering if there is an automatic way to make subcategories and sub-subcategories with 0 active items to automatically turn off. Or if there is a SQL that would work for this.
Our site has fabric that is link into many subcategories and once it is sold out, I have to manually go in and toggle or delete the sub and sub-subcategories. It would be nice to be able to do this automatically.
Thanks for any help! Still loving ZenCart!
Mona
http://www.QuiltsInMontana.com

3 Feb 2015, 3:32 PM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Automatic or sql to turn off subcategories and sub-subcategories with 0 active items

configuration->Layout_settings->**Categories with 0 Products Status = 0
**
At least that is what I think you coud be looking for.

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

3 Feb 2015, 4:14 PM
#3
stxmona avatar

stxmona

Zen Follower

Join Date:
Aug 2008
Posts:
103
Plugin Contributions:
0

Re: Automatic or sql to turn off subcategories and sub-subcategories with 0 active items

Thanks RodG for the reply .... my configuration IS set up like that (Categories with 0 Products Status = 0 ) however, it does not toggle the sub nor sub subcategories to off.

Any other ideas?
Mona
http://www.QuiltsInMontana.com

3 Feb 2015, 4:23 PM
#4
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Automatic or sql to turn off subcategories and sub-subcategories with 0 active items

stxmona:

Any other ideas?
Mona
http://www.QuiltsInMontana.com

Sorry, no I don't.

Hopefully someone else with have some idea.

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

3 Feb 2015, 7:13 PM
#5
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: Automatic or sql to turn off subcategories and sub-subcategories with 0 active items

You may be able to add an observer (to listen for stock decrements)... Then do a SQL query to see if all products in the category are disabled (or have a quantity of 0)... Then disable the category if needed (and check the parent categories recursively). Not the most efficient, but might provide a starting place.

The glass is not half full. The glass is not half empty. The glass is simply too big!
Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

3 Feb 2015, 7:20 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Automatic or sql to turn off subcategories and sub-subcategories with 0 active items

I have code to make this happen that I built into an upcoming future release ... https://github.com/zencart/zencart/pull/231/files

Let me get it translated for v1.5.4 and maybe from that you can address it for your v1.5.3 ... how hard can it be? :lookaroun

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!]
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!

3 Feb 2015, 7:30 PM
#7
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Automatic or sql to turn off subcategories and sub-subcategories with 0 active items

Ajeh:

how hard can it be? :lookarounNot very ... with YOU on the case!!:smile:

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.

4 Feb 2015, 2:35 PM
#8
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Automatic or sql to turn off subcategories and sub-subcategories with 0 active items

Ajeh:

how hard can it be? :lookaroun

<2 years later>
"Almost got it".....

Cheers
RodG :)

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

4 Feb 2015, 2:51 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Automatic or sql to turn off subcategories and sub-subcategories with 0 active items

Bzzzz ... times up!

These are the changes needed for v1.5.4 to make the Empty Categories or Categories with just Products with status set off to not show ...

Add via the Tools ... Install SQL Patches ...

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());

that will be in the Configuration ... Layout Settings ...

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!]
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!

4 Feb 2015, 3:28 PM
#10
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Automatic or sql to turn off subcategories and sub-subcategories with 0 active items

Ajeh:

Bzzzz ... times up!

Can anyone say "over achiever". <grin>

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

4 Feb 2015, 3:34 PM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Automatic or sql to turn off subcategories and sub-subcategories with 0 active items

What can I say? I heard you guys crying for this a lot and built it into v1.6 so I just messed around and made it work with v1.5.4 ... keeps me on my toes ... :cool:

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!]
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!

4 Feb 2015, 3:37 PM
#12
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Automatic or sql to turn off subcategories and sub-subcategories with 0 active items

Ajeh:

What can I say? I heard you guys crying for this a lot and built it into v1.6 so I just messed around and made it work with v1.5.4 ... keeps me on my toes ... :cool:

and that's why we LOVE you!!!:clap:

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.