× English Section!

We will be more than happy to help you with problems related to our services and products. Please feel free to write it down as clear as possible

Display subcategory products, full depth - VM 3

Περισσότερα
2 Χρόνια 9 Μήνες πριν - 2 Χρόνια 9 Μήνες πριν #221 από infogate
Display subcategory products, full depth - VM 3 δημιουργήθηκε από infogate
if anyone needs an updated version for latest virtuemart, I have modified it to work

1st Step
Modify the following file
/administrator/components/com_virtuemart/models/category.php

...and add in the end the following function before the last closing tag (})
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);
                  }
               }
    }

2nd Step
Modify the following file
/administrator/components/com_virtuemart/models/product.php
Replacing the following code
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 {
				$where[] = ' `pc`.`virtuemart_category_id` IN ('.implode(',',$virtuemart_category_id).') ';
			}

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

3d Step
Modify the main configuration file
/administrator/components/com_virtuemart/virtuemart.cfg
and add the following line at the end of all the other configurations
show_all_subcat_products=1

4th Step
Go to Virtuemart -> Configuration and the tab "Shopfront".
Diselect the "Show products of subcategories"

Save twice so that the virtuemart.cfg will be loaded normally and you are ready to enjoy a beer or a glass of wine ;)


The best possible way to start your online marketing : fspirits.com/go/leadsleap-home
Explode Your Web Site Traffice: fspirits.com/go/sparktraffic
Start your affiliate journey here: fspirits.com/go/olsp-academy
Best Solution To Create Videos: fspirits.com/go/create-studio-pro
Best Solution To Create Graphics: fspirits.com/go/clickdesigns
Smart Chat Automation: fspirits.com/go/chatterpal
Multi-Purpose Video Maker: fspirits.com/go/avatar-builder
Multi-Purpose Video Creator: fspirits.com/go/video-creator
AI Human Spokesperson Videos: fspirits.com/go/humanpal

Last edit: 2 Χρόνια 9 Μήνες πριν by infogate.

Παρακαλούμε Σύνδεση ή Δημιουργία λογαριασμού για να συμμετάσχετε στη συζήτηση.

Χρόνος δημιουργίας σελίδας: 0.035 δευτερόλεπτα
Powered by Kunena Φόρουμ