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

el02154

  • Beginner
  • *
  • Posts: 19
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: 10302
  • 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: 19
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: 28225
  • 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 3.8.9.10473 on Joomla 3.9.28 PHP 7.4.14

el02154

  • Beginner
  • *
  • Posts: 19
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: 28225
  • 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 3.8.9.10473 on Joomla 3.9.28 PHP 7.4.14

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).') ';
         }