Author Topic: Products from subcategories in category view - more than 1 level depth  (Read 1084 times)

valekichia

  • Beginner
  • *
  • Posts: 28
Hello!
Does anybody know how to display the products from all levels of sub categories in category view?

I'm using Joomla 3.7.1 and VM 3.2.2

My VM category tree looks like this:

[root]
- main category 1
-- sub category 1
-- sub category 2
-- sub category 3
--- sub sub category 3a
--- sub sub category 3b
--- sub sub category 3c
- main category 2 ...
- main category 3 ...

 I set "Show products of subcategories" on yes in VM config.

But what I get is that only products from the first level of subcategory is displayed in top level category.

For example on category 1 page only products from subcategories 1 2 and 3 (= 1st level of depth) are displayed. I'd like also products from sub sub categories 3a 3b and 3c (= 2nd level of depth and all possible sub levels) to be displayed.

Is there a way to achieve this?

Thank you

marvays

  • Jr. Member
  • **
  • Posts: 319
    • richta.cz
  • Skype Name: marvays
I'm also interested.

pinochico

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 498
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
- You can manually add all subcategories on product
- You can use plugin for automatically add all parent subcategories, if you add only last subcategory on product (attachment)
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

balai

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1415
Guys this is a strongly discouraged method to use.
The way it works is by querying each level down your category tree, to find the products.

For example we have that tree:
Parent
-sub1
--sub1.1
--sub1.2
-sub2
--sub2.1
--sub2.2

That means 7 sql queries, when you pick the "parent" category. In a modest scenario this will be extremely counter performant.

+1 for pinochio's answer
To avoid duplicate pages, use the "canonical category" found inside each product.


pinochico

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 498
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
to balai:

Quote
To avoid duplicate pages, use the "canonical category" found inside each product.

Of course, this info I think is automatically, but maybe is need write there, because what is for me logic and automatycally, for another people maybe not :)
Thanks
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates