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

el02154

  • Beginner
  • *
  • Posts: 20
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: 10518
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.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 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

el02154

  • Beginner
  • *
  • Posts: 20
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: 28324
  • 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.2 10661 on Joomla 3.10.9 PHP 7.4.29

el02154

  • Beginner
  • *
  • Posts: 20
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: 28324
  • 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.2 10661 on Joomla 3.10.9 PHP 7.4.29

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: 10283
  • VM3.9 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/