To hide all the child products from mod_virtuemart_product (Featured, Best Sell, Latest products) do the following
1) Edit the file "administrator/components/com_virtuemart/models/product.php" and make the following modifications:
1.a) Modify statement (~ line 174):
function sortSearchListQuery($onlyPublished=true,$virtuemart_category_id = false, $group=false,$nbrReturnProducts=false){
to:
function sortSearchListQuery($onlyPublished=true,$virtuemart_category_id = false, $group=false,$nbrReturnProducts=false, $only_parent_products=false){
1.b) After statement (~ line 245)
if($onlyPublished){ $where[] = ' p.`published`="1" '; }
Add the following code:
if ($only_parent_products) { $where[] = ' p.`product_parent_id`="0" '; }
1.c) Modify statement (~line 834):
public function getProductListing($group = false, $nbrReturnProducts = false, $withCalc = true, $onlyPublished = true, $single = false,$filterCategory= true, $category_id=0){
to:
public function getProductListing($group = false, $nbrReturnProducts = false, $withCalc = true, $onlyPublished = true, $single = false,$filterCategory= true, $category_id=0, $only_parent_products=false){
1.d) Modify statement (~line 863 ):
$ids = $this->sortSearchListQuery($onlyPublished, $this->virtuemart_category_id, $group, $nbrReturnProducts);
to:
$ids = $this->sortSearchListQuery($onlyPublished, $this->virtuemart_category_id, $group, $nbrReturnProducts, $only_parent_products);
2) Edit the file "modules/mod_virtuemart_product/mod_virtuemart_product.php" and modify statement (~ line 59):
$products = $productModel->getProductListing($Product_group, $max_items, $show_price, true, false,$filter_category, $category_id);
to:
$products = $productModel->getProductListing($Product_group, $max_items, $show_price, true, false,$filter_category, $category_id, true);