News:

Support the VirtueMart project and become a member

Main Menu

List products in subcategories

Started by gba, December 17, 2013, 16:50:17 PM

Previous topic - Next topic

gba

Dear VM pros!

I have i.e. following category hierarchie:
- Cat1
- - Cat1_1
- - - Cat1_1_1
- Cat2
...

On the browsepage I need to display all products not only i.e. of Cat1, but also of Cat1_1 and Cat1_1_1.

Do you have any idea how to achieve that?

Thank you very much in advance for your help!

Best regards,
Gerald

gba

Hello all!

One month ago I posted about listing products in subcategories.
Does anyone have any idea how to solve that issue?

Best regards
Gerald


AH

Regards
A

Joomla 3.10.11
php 8.0

balai

You did not get a response because the question is vague.

QuoteI have i.e. following category hierarchie:
- Cat1
- - Cat1_1
- - - Cat1_1_1
- Cat2
...

On the browsepage I need to display all products not only i.e. of Cat1, but also of Cat1_1 and Cat1_1_1.

In which browse page? When do you want to get products from these?

Ghost

#5
He wants to display products of child categories in parent category. This can be done with core hack. I'm sure a solution (for VM2) was posted on this forum at some point.

Another option is to assign products to parent categories. This plugin can do it automatically https://extensions.joomla.org/extension/auto-parent-categories-for-virtuemart-joomla-3-x.


GJC Web Design

there is also a switch in the products model for this ...

see around line 367

if ($virtuemart_category_id > 0) {
$joinCategory = TRUE;
if(true){
$where[] = ' `pc`.`virtuemart_category_id` = ' . $virtuemart_category_id;
} else {
/*GJC add subcat products*/
$catmodel = VmModel::getModel ('category');
$childcats = $catmodel->getChildCategoryList(1, $virtuemart_category_id,null, null, true);
$cats = $virtuemart_category_id;
foreach($childcats as $childcat){
$cats .= ','.$childcat->virtuemart_category_id;
}
$joinCategory = TRUE;
$where[] = ' `pc`.`virtuemart_category_id` IN ('.$cats.') ';
}


GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 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
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation