Ajax search: Search only parent products

Please post your questions and problems with any of our extensions which you are using

Ajax search: Search only parent products

Postby admin » Wed Dec 18, 2013 7:58 pm

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
admin
Site Admin
 
Posts: 2654
Joined: Wed Jan 06, 2010 11:43 pm

Return to VirtueMart and Joomla Extensions (free or paid)