Author Topic: Sub-categories products shown in parent category view: how to? ->feature request  (Read 5315 times)

SteP[IT]

  • Jr. Member
  • **
  • Posts: 199
  • Independent Websites Builder
    • MMC Edizioni - Italian Publisher (First Class PaperBooks)
  • VirtueMart Version: 3.4.3
I have many customer's websites were parents categories have no product assigned to, but have many sub-categories (also nested) with many products: if I'm not wrong, according to the current VM3 way to show products in category view, you can't show all the subcategories assigned products in the parent category view.
Is there a way to get the parent category view displaying all subcategories tree assigned products without the needing of assigning them to all the upper-level categories in the tree?
It would be better to have a config option to get this result.
Waiting for kindly sggestions.
Regards
J 3.9.2 - VM 3.4.3

MMC EDIZIONI - Italian High-Quality PaperBooks Publisher
Site: https://www.mmcedizioni.it

SteP[IT]

  • Jr. Member
  • **
  • Posts: 199
  • Independent Websites Builder
    • MMC Edizioni - Italian Publisher (First Class PaperBooks)
  • VirtueMart Version: 3.4.3
Any hint from anybody? Thanks in advance.
J 3.9.2 - VM 3.4.3

MMC EDIZIONI - Italian High-Quality PaperBooks Publisher
Site: https://www.mmcedizioni.it

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9223
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Quote
assigning them to all the upper-level

afaik this is the standard way to do this -- I think there is a plugin to automate it
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

SteP[IT]

  • Jr. Member
  • **
  • Posts: 199
  • Independent Websites Builder
    • MMC Edizioni - Italian Publisher (First Class PaperBooks)
  • VirtueMart Version: 3.4.3
Adding the same product to the upper tree parent categories is not the best choise to get a good SEO rank: in that way you get as many products urls as the category number is (one per each parent category), all pointing to the same identical product page content.
In my opinion, simply showing all sub-tree products in parents categories without forcing them to be assigned to that categories will avoid this: the link to the product will remain the same only one (it has been assigned to only one category), also if displayed in upper categories. This is why I would like to see that option in VM core config.
J 3.9.2 - VM 3.4.3

MMC EDIZIONI - Italian High-Quality PaperBooks Publisher
Site: https://www.mmcedizioni.it

franzpeter

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 467
    • 2in1-online | Software, Mac, PC, Netzwerk, Drucker, Pad, Display
  • VirtueMart Version: Virtuemart 3.2.6
Is that really a problem for SEO Rank? Google for example takes care about canonical url. So if you display same product in different categories means that you just assign the same product with the product categories reference table. It is just a display thing, the canonical url gives the correct or better true url.  I doubt about that it has any influence on SEO Rank!

SteP[IT]

  • Jr. Member
  • **
  • Posts: 199
  • Independent Websites Builder
    • MMC Edizioni - Italian Publisher (First Class PaperBooks)
  • VirtueMart Version: 3.4.3
But I still have some J 2.5.x-VM3 websites, and I can't see there any VM-generated canonical: am I wrong?
J 3.9.2 - VM 3.4.3

MMC EDIZIONI - Italian High-Quality PaperBooks Publisher
Site: https://www.mmcedizioni.it

Rune Rasmussen

  • Jr. Member
  • **
  • Posts: 161
  • Is the stable release stable?
    • SYNTAX ERROR
  • VirtueMart Version: Latest ;)
I second this request, as it would be quite useful and helpful to have a setting for this in core.

Having them assign to all parents make it unnecessary complex if you also want to display the products in other categories for t.ex campaigns, or just because they fit in several. The way the bulk assign of products to categories works now also makes it more complex than needed, since it doesn't show already selected, and you have to select all, else it's removing products from previous - it doesn't just add the newly selected...

Oh, and the automated plugins available works for all the cart. But sometimes it would be nice to decide per category, if you want to display from subs... other thing is that those plugins also has their downsides, and conflicts with other things here and there.
Rune Rasmussen - http://www.syntaxerror.no
Norske nettløsninger og integrasjoner, CONSIGNOR EDI, Mamut ordreimport og produkteksport, kortbetaling og faktura m.m.

Norsk Joomla! - Norwegian Translation Team - http://www.norskjoomla.no

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4067
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Hi,
You can add a loop (the best is to make changes in your template file) to get the products for each 1st level subcategories.
simply adapt and reuse the core function in JOOMLA/components\com_virtuemart\views\category\view.html.php
Code: [Select]
$ids = $productModel->sortSearchListQuery (TRUE, $this->categoryId);
or if you need all products then you have to get all sub categories and products. But this can be a heavy work in a big shop

If you do the overides in your template, then you can safe update virtuemart.

I think the first solution, is better for safe, because the product are displayed a level before in your site. But you see only one level more.

deuce4884

  • Beginner
  • *
  • Posts: 3
  • A beginner
Hi,
You can add a loop (the best is to make changes in your template file) to get the products for each 1st level subcategories.
simply adapt and reuse the core function in JOOMLA/components\com_virtuemart\views\category\view.html.php
Code: [Select]
$ids = $productModel->sortSearchListQuery (TRUE, $this->categoryId);
or if you need all products then you have to get all sub categories and products. But this can be a heavy work in a big shop

If you do the overides in your template, then you can safe update virtuemart.

I think the first solution, is better for safe, because the product are displayed a level before in your site. But you see only one level more.

I'm guessing you mean to do an override to the default view for virtuemart category. I'm new to Virtuemart so please bare with me. I'm currently running version 3.0.9 on Joomla 3.4.2. The shop I'm currently working on is not very big, so how would you implement this to show all products?

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4067
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
My solution only get 1 level deeper.
To get all subcategories product, it's to slow to use it that way.

deuce4884

  • Beginner
  • *
  • Posts: 3
  • A beginner
Oh ok. I may be able to use only going 1 level deeper. How would I go about implementing the foreach loop in the template file to do that?