News:

Support the VirtueMart project and become a member

Main Menu

Load products from all levels of sub-categories

Started by idor, April 08, 2020, 00:17:53 AM

Previous topic - Next topic

idor

Hello,
I use Joomla 3.9.15 & VirtueMart 3.6.10 10211
I have a website with a category tree with 3, 4 levels of categories  (or maybe more), and millions of products.
I want to show all products from subcategories in their parent page.
I enabled "Show products of subcategories" from VM configuration > shopfront
but I only get the products of second level in the first parent.
What I need is to load ALL products from ALL levels.
ej. Cat.1
            >Cat.1.a & Cat. 1.b
                                        >Cat1.a.i & Cat1.a.ii & Cat. 1.b.i & Cat. 1.b.ii>...etc


When I click from the menu Cat.1 I need to load products from all sub-categories and sub-sub-categories.

Now I get products only from Cat.1.a & Cat. 1.b

Could anyone help with this?

Thank you!

balai

Hi

I would not recommend to do that. It has to run several sub-queries in your parent category's page that will make it very "heavy".
Fist have to find all the sub-categories of each node and then get the products of each node. This has to be done for each node of your tree.

Instead my suggestion is to assign your products to your parent category as well and disable the setting "Show products of subcategories".
If you have concerns about SEO, please use the "canonical category" to set the product's main category.

idor

#2
I need to do this through PHP, because assigning the product in more than one category, the breadcrumbs are messing up.