VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: goldlink on June 01, 2018, 18:46:44 PM

Title: Hide empty categories
Post by: goldlink on June 01, 2018, 18:46:44 PM
Hi, I've been trying for some time to make a change in the management system categories that I think could be implemented by default on VM, because it's very useful in several cases. I've a site with 8 main categories but each category has about 70/80 categories under it; understand well how difficult and dispersed the consultation by users, as there are many very often empty categories. It would therefore be a good thing not to show the categories that do not present articles within them.

What do you think? I was trying to make a change starting from the layout file of the categories, but it also arose the problem of always showing the 8 main categories (even if they do not present articles but only other categories).

Do you have any advice to give?

Thank you very much, I hope I have asked an interesting and non-trivial question.

Joomla 3.8.6
Virtuemart 3.2.4

goldlink.
Title: Re: Hide empty categories
Post by: balai on June 04, 2018, 11:59:58 AM
Not sure if you are willing to spend a few bucks on that, but it's a feature that can be found in filtering extensions like Custom Filters.
https://breakdesigns.net/extensions/joomla/custom-filters
Title: Re: Hide empty categories
Post by: goldlink on June 04, 2018, 15:23:55 PM
Thans balai, it would not be a problem to spend something, I immediately take a look!

But I was thinking of finding someone to create something to implement maybe in the next updates of vurtuemart...
Title: Re: Hide empty categories
Post by: jjk on June 04, 2018, 21:57:22 PM
Why don't you simply unpublish empty subcategories?
Title: Re: Hide empty categories
Post by: goldlink on June 04, 2018, 23:39:01 PM
It's not very practical, I've about 70/80 sub-categories for each main-category and I can't manually manage the unpublish every time a category becomes empty and this happens often...  :-\
Title: Re: Hide empty categories
Post by: balai on June 05, 2018, 11:24:00 AM
I don't think that a change that you will made will be easily implemented in the next updates.
Anyway the decision is yours.
Title: Re: Hide empty categories
Post by: goldlink on June 05, 2018, 11:57:21 AM
Thanks balai, I will try to find a solution, at the end show an empty category is never a beautiful thing, much less a large number of empty categories...
..if there will be updates I will post them, thanks again ;)
Title: Re: Hide empty categories
Post by: Studio 42 on June 05, 2018, 15:57:44 PM
Problem is to hide subcategories, you have to count all products in subcategories and check if any category have valid product.
But Virtuemart hide/display by config product without stock, unpublished(and certainly other cases)
Some custom plugin can hide products too
If you have many products, this can be very expensive query to check for this.