VirtueMart Forum

VirtueMart 2 + 3 => Product creation => Topic started by: kiasati on January 25, 2018, 10:38:11 am

Title: how to categorize products in virtuemart
Post by: kiasati on January 25, 2018, 10:38:11 am
Hi

I sell CCTV cameras on my site.
my product categories are like the picture below:
(http://uupload.ir/files/5dme_cameras.jpg)

when creating a new product for "ip-bullet" for example, should i add the product to "camera" "ip camera" and "ip-bullet" categories, or only "ip-bullet"???
because i want the product to be shown under "ip camera" category. I mean when a user clicks on "ip camera" menu item, i want the products in sub-categories (in this case: ip-bullet and hd-bullet) to be shown in "ip camera" category page.
so should i add the product to all three categories or only the "ip-bullet" category?
Title: Re: how to categorize products in virtuemart
Post by: GJC Web Design on January 25, 2018, 11:28:16 am
I would only ip-bullet and enable the hidden switch in models/products.php

if ($virtuemart_category_id > 0) {
         $joinCategory = TRUE;
         if(VmConfig::get('show_subcat_products',false)){
            /*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.') ';
         } else {
            $where[] = ' `pc`.`virtuemart_category_id` = ' . $virtuemart_category_id;
         }
      }


enable

if(VmConfig::get('show_subcat_products',false)){