Author Topic: Display subcategory products, full depth - VM 3.2.2  (Read 31451 times)

el02154

  • Beginner
  • *
  • Posts: 23
Re: Display subcategory products, full depth - VM 3.2.2
« Reply #30 on: November 29, 2020, 20:00:52 pm »
Debug Line 461 show_all_subcat_products <pre></pre><br />

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10688
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
Re: Display subcategory products, full depth - VM 3.2.2
« Reply #31 on: November 30, 2020, 00:19:45 am »
so u haven't set up your config correctly

search on here how to do it

show_all_subcat_products=1
GJC Web Design
VirtueMart and Joomla Developers - php developers https://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
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

el02154

  • Beginner
  • *
  • Posts: 23
Re: Display subcategory products, full depth - VM 3.2.2
« Reply #32 on: November 30, 2020, 07:48:29 am »
I have included already this in /administrator/components/com_virtuemart/virtuemart.cfg (check attached).
I should do something more?

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28455
  • Always on vacation
    • Jenkin Hill Internet
Re: Display subcategory products, full depth - VM 3.2.2
« Reply #33 on: November 30, 2020, 11:56:41 am »
Did you then save VM configuration twice to ensure the setting is applied?
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VirtueMart 4.0.12 10777  J 3.10.11 PHP 7.4.30

el02154

  • Beginner
  • *
  • Posts: 23
Re: Display subcategory products, full depth - VM 3.2.2
« Reply #34 on: November 30, 2020, 21:13:53 pm »
 :) :) :) :) :)

I did right now and all seem ok!!! I did not know I should save twice. Thank you all for helping!

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28455
  • Always on vacation
    • Jenkin Hill Internet
Re: Display subcategory products, full depth - VM 3.2.2
« Reply #35 on: December 01, 2020, 10:35:09 am »
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VirtueMart 4.0.12 10777  J 3.10.11 PHP 7.4.30

wadou3a

  • Beginner
  • *
  • Posts: 1
Re: Display subcategory products, full depth - VM 3.2.2
« Reply #36 on: November 27, 2021, 10:00:14 am »
if anyone needs an updated version for latest virtuemart, I have modified it to work


/administrator/components/com_virtuemart/models/category.php

     static public function categoryFlatList(&$cats, $catId) {
         $catmodel = VmModel::getModel ('category');
      $childcats = $catmodel->getChildCategoryList(1, $catId,null, null, true);
         foreach($childcats as $k=>$childcat){
            if(!empty($childcat->virtuemart_category_id)){
            $cats .= $childcat->virtuemart_category_id .',';
            self::categoryFlatList($cats, $childcat->virtuemart_category_id);
                  }
               }
    }
   

/administrator/components/com_virtuemart/models/product.php

         if(VmConfig::get('show_subcat_products',false)){
            /*GJC add subcat products*/
            $catmodel = VmModel::getModel ('category');
            $cats = '';
            foreach($virtuemart_category_id as $catId){
               $childcats = $catmodel->getChildCategoryList(1, $catId,null, null, true);
               foreach($childcats as $k=>$childcat){
                  if(!empty($childcat->virtuemart_category_id)){
                     $cats .= $childcat->virtuemart_category_id .',';
                  }
               }
               $cats .= $catId;
            }
                if(!empty($cats)){
                    $joinCategory = TRUE;
                    $where[] = ' `pc`.`virtuemart_category_id` IN ('.$cats.') ';
                }
         } else if (VmConfig::get('show_all_subcat_products',false)) {
            $cats = '';
            foreach($virtuemart_category_id as $catId){
               VmModel::getModel('category')->categoryFlatList($cats, $catId);
               $this->filter_order = '';
               $orderBy='';
               $cats .= $catId;
            }
                if(!empty($cats)){
                    $joinCategory = TRUE;
                    $where[] = ' `pc`.`virtuemart_category_id` IN ('.$cats.') ';
                }
         } else {
            $where[] = ' `pc`.`virtuemart_category_id` IN ('.implode(',',$virtuemart_category_id).') ';
         }




infogate

  • Beginner
  • *
  • Posts: 5
  • A beginner
  • Skype Name: infogate1976
Re: Display subcategory products, full depth - VM 3.2.2
« Reply #37 on: December 20, 2021, 02:16:37 am »
I can confirm that the above code (from wadou3a)  works normally but you have to be sure that the following option in VM Configuration  and shopfront tab is disabled.

Quote
show products in subcategories = false

I wonder why this code is not still implemented to official release.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10530
  • VM4.0.7 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Display subcategory products, full depth - VM 3.2.2
« Reply #38 on: April 30, 2022, 23:04:46 pm »
It is imho part of the core. Please try vm4
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

razor7

  • Jr. Member
  • **
  • Posts: 366
    • MGSCreativa - Professional VM!
Re: Display subcategory products, full depth - VM 3.2.2
« Reply #39 on: December 22, 2022, 21:38:54 pm »
It is imho part of the core. Please try vm4

Hi Milbo! I'm using VM 4.0.6 and J 3.10.11 but after enabling show_subcat_products I'm still only getting level 2 category products. IE:

Cat Parent <-- clicked this cat link and
  Cat Child 1 <-- got products from here
  Cat Child 2 <-- got products from here
    Cat Grandchild 1 <-- didn't got products
    Cat Grandchild 2 <-- didn't got products
    Cat Grandchild 3 <-- didn't got products
  Cat Child 3 <-- got products from here

Is this feature implemented in VM?

Thanks!
MGS Creativa - VirtueMart Payment Plugin Experts
http://www.mgscreativa.com

Take a look at our downloads section for VirtueMart payment plugins and mouch more!
http://www.mgscreativa.com/en/online-store