News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Show child product in search

Started by BulletProof47, November 23, 2014, 06:10:48 AM

Previous topic - Next topic

BulletProof47

Hello all, I used the instruction given in this forum post : http://forum.virtuemart.net/index.php?topic=103702.0
It was working but child product are not showing in search results too.
The code I've used is as below:
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" '; }


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 ):
[code]
$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):   
[code]
$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);


Please help me.Thanks