VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: razol on June 29, 2012, 10:24:35 AM

Title: Virtuemart 2.0.6 Search for Product SKU Faild!!
Post by: razol on June 29, 2012, 10:24:35 AM
Hi all!

I found a bug in Virtuemart search module. No result if the product sku contains "-" sign. How can I fix this and which files? For me it is very important because each product contains the sku "-" sign! : (

BIG Thanks! ;)

razol!
Title: Re: Virtuemart 2.0.6 Search for Product SKU Faild!!
Post by: RobertL on July 15, 2012, 14:26:50 PM
There's a 2 3 part solution for this so far biggest blunder in my opinion in VM2

For Frontend
1. edit plugins/search/virtuemart.php to enable search by SKU

Line 137
$query = "SELECT DISTINCT CONCAT( a.product_name,' (',p.product_sku,')' ) AS title, a.virtuemart_product_id , b.virtuemart_category_id ,   a.product_s_desc   AS text, b.category_name as section,

Change to:
$query = "SELECT DISTINCT CONCAT( a.product_name,' (',p.product_sku,')' ) AS title, a.product_name , p.product_sku , a.virtuemart_product_id , b.virtuemart_category_id ,   a.product_s_desc   AS text, b.category_name as section,

2. edit administrator/components/com_virtuemart/helpers/config.php to allow search by "-" character. This is from rippergr http://forum.virtuemart.net/index.php?topic=101774.0

Line 887
return mb_ereg_replace('[^\w'.preg_quote($custom).']', '', $source);

Change to:
return mb_ereg_replace('/[^\w'.preg_quote($custom).']/', '', $source);

3. edit language/en-GB/en-GB.com_virtuemart.ini since message is not defined for COM_VIRTUEMART_SEARCH_RESULTS just add following line anywhere (or in order, no matter). You can edit the message to whatever you want
COM_VIRTUEMART_SEARCH_RESULTS="Search results for"
Title: Re: Virtuemart 2.0.6 Search for Product SKU Faild!!
Post by: babouz on September 05, 2012, 16:23:16 PM
Quote from: RobertL on July 15, 2012, 14:26:50 PM
There's a 2 3 part solution for this so far biggest blunder in my opinion in VM2

Hi RobertL,
I'm on virtuemart 2.5.6 and this problem still exist... unfortunately your solution doesn't work...
Could you help me please to fix it ?