Author Topic: how to categorize products in virtuemart  (Read 900 times)


  • Jr. Member
  • **
  • Posts: 109
    • JoomlaJoy
how to categorize products in virtuemart
« on: January 25, 2018, 10:38:11 am »

I sell CCTV cameras on my site.
my product categories are like the picture below:

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?

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9478
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: how to categorize products in virtuemart
« Reply #1 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;
            /*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;


GJC Web Design
VirtueMart and Joomla Developers - php developers
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
Contact for any VirtueMart or Joomla development & customisation