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

Virtuemart 2.0.6 Search for Product SKU Faild!!

Started by razol, June 29, 2012, 10:24:35 AM

Previous topic - Next topic

razol

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!

RobertL

#1
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"

babouz

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 ?
Where is mum? She is in the bathroom. Where is dad? He is not at home. Why? I don't know.