Author Topic: List products in subcategories  (Read 2913 times)

gba

  • Jr. Member
  • **
  • Posts: 334
List products in subcategories
« on: December 17, 2013, 16:50:17 pm »
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

  • Jr. Member
  • **
  • Posts: 334
Fw: List products in subcategories
« Reply #1 on: January 14, 2014, 09:29:32 am »
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

gba

  • Jr. Member
  • **
  • Posts: 334
Re: List products in subcategories
« Reply #2 on: September 29, 2016, 15:32:31 pm »
*push*  ;)

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3506
  • VirtueMart Version: 3.8.9
Re: List products in subcategories
« Reply #3 on: September 29, 2016, 15:42:41 pm »
Develop a plugin?
Regards
A

Joomla 3.9.27
php 7.4

balai

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1461
Re: List products in subcategories
« Reply #4 on: September 30, 2016, 11:31:13 am »
You did not get a response because the question is vague.

Quote
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.

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

Ghost

  • Jr. Member
  • **
  • Posts: 422
Re: List products in subcategories
« Reply #5 on: September 30, 2016, 12:15:46 pm »
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.

balai

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1461
Re: List products in subcategories
« Reply #6 on: September 30, 2016, 13:01:17 pm »

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10354
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: List products in subcategories
« Reply #7 on: September 30, 2016, 23:38:08 pm »
there is also a switch in the products model for this ...

see around line 367

Code: [Select]
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 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