News:

Looking for documentation? Take a look on our wiki

Main Menu

how to categorize products in virtuemart

Started by kiasati, January 25, 2018, 10:38:11 AM

Previous topic - Next topic

kiasati

Hi

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

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)){
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 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
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation