VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: SteP[IT] on April 18, 2015, 18:15:22 PM

Title: Sub-categories products shown in parent category view: how to? ->feature request
Post by: SteP[IT] on April 18, 2015, 18:15:22 PM
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
Title: Re: Sub-categories products shown in parent category view: how to? ->feature request
Post by: SteP[IT] on April 22, 2015, 09:29:04 AM
Any hint from anybody? Thanks in advance.
Title: Re: Sub-categories products shown in parent category view: how to? ->feature request
Post by: GJC Web Design on April 22, 2015, 09:33:20 AM
Quoteassigning them to all the upper-level

afaik this is the standard way to do this -- I think there is a plugin to automate it
Title: Re: Sub-categories products shown in parent category view: how to? ->feature request
Post by: SteP[IT] on April 22, 2015, 09:55:32 AM
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.
Title: Re: Sub-categories products shown in parent category view: how to? ->feature request
Post by: franzpeter on April 22, 2015, 10:18:13 AM
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!
Title: Re: Sub-categories products shown in parent category view: how to? ->feature request
Post by: SteP[IT] on April 22, 2015, 10:25:02 AM
But I still have some J 2.5.x-VM3 websites, and I can't see there any VM-generated canonical: am I wrong?
Title: Re: Sub-categories products shown in parent category view: how to? ->feature request
Post by: Rune Rasmussen on April 22, 2015, 20:06:43 PM
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.
Title: Re: Sub-categories products shown in parent category view: how to? ->feature request
Post by: Studio 42 on April 22, 2015, 22:16:54 PM
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
$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.
Title: Re: Sub-categories products shown in parent category view: how to? ->feature request
Post by: deuce4884 on July 30, 2015, 20:22:04 PM
Quote from: Studio 42 on April 22, 2015, 22:16:54 PM
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
$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?
Title: Re: Sub-categories products shown in parent category view: how to? ->feature request
Post by: Studio 42 on July 30, 2015, 22:23:37 PM
My solution only get 1 level deeper.
To get all subcategories product, it's to slow to use it that way.
Title: Re: Sub-categories products shown in parent category view: how to? ->feature request
Post by: deuce4884 on July 30, 2015, 22:53:30 PM
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?