Page 1 of 1

Ajax search: Search only parent products

PostPosted: Wed Dec 18, 2013 7:58 pm
by admin
To update the ajax search to show only the parent products, you may want to modify the query within
\modules\mod_vm_ajax_search\ajax\index.php

to
Code: Select all
if (!defined('VMLANG')) define('VMLANG', 'en-gb');
        $q =
          " select p.virtuemart_product_id, l.product_name from #__virtuemart_products AS p, #__virtuemart_products_".VMLANG." as l where p.product_sku = '".$db->getEscaped($keyword)."' and p.published = '1' and p.virtuemart_product_id = l.virtuemart_product_id "
        ." and p.product_parent_id = 0 "
        ." LIMIT 0,".$prods." "."\n"
         ." union (select p.virtuemart_product_id, l.product_name from #__virtuemart_products AS p, #__virtuemart_products_".VMLANG." as l where l.product_name LIKE '".$db->getEscaped($keyword)."%' and p.published = '1' and p.virtuemart_product_id = l.virtuemart_product_id and p.product_parent_id = 0 LIMIT 0,".$prods.")"."\n"
         ." union (select p.virtuemart_product_id, l.product_name from #__virtuemart_products AS p, #__virtuemart_products_".VMLANG." as l where (l.product_name LIKE '%".$db->getEscaped($keyword)."%' ".$or.") and p.published = '1' and p.virtuemart_product_id = l.virtuemart_product_id and p.product_parent_id = 0 LIMIT 0,".$prods.")"."\n"
        ." union (select p.virtuemart_product_id, l.product_name from #__virtuemart_products AS p, #__virtuemart_products_".VMLANG." as l where p.product_sku LIKE '".$db->getEscaped($ko)."%' and p.published = '1'  and p.virtuemart_product_id = l.virtuemart_product_id and p.product_parent_id = 0 LIMIT 0,".$prods.")"."\n"
        ." union (select p.virtuemart_product_id, l.product_name from #__virtuemart_products AS p, #__virtuemart_products_".VMLANG." as l where l.product_desc LIKE '%".$db->getEscaped($keyword)."%' and p.published = '1' and p.virtuemart_product_id = l.virtuemart_product_id and p.product_parent_id = 0 LIMIT 0,".$prods.")"."\n"
        ." union (select p.virtuemart_product_id, l.product_name from #__virtuemart_products AS p, #__virtuemart_products_".VMLANG." as l where l.product_s_desc LIKE '%".$db->getEscaped($keyword)."%' and p.published = '1' and p.virtuemart_product_id = l.virtuemart_product_id and p.product_parent_id = 0 LIMIT 0,".$prods.")"."\n"
      
         ." LIMIT 0,".$prods;
      }


Best Regards,
Stan