VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: dmuntean on January 12, 2012, 04:14:56 AM

Title: Backend product search omits product SKU
Post by: dmuntean on January 12, 2012, 04:14:56 AM
Hi,

I've just noticed that when you attempt to search for products in the back-end, it does not include results from product_sku. It would be helpful if this could be included. I have most of my products memorized by their sku, not the name. Oh, it would also be neat if after using search product, then editing a product and saving, it would return you to your original search query.

Thanks!
Title: Re: Backend product search omits product SKU
Post by: dmuntean on January 12, 2012, 04:18:03 AM
Actually, would you be able to point me to the right file? I'd like to go ahead and add product_sku to the search query. Thanks
Title: Re: Backend product search omits product SKU
Post by: pfasshauer on January 24, 2012, 04:35:46 AM
Did you ever solve this issue?
Title: Re: Backend product search omits product SKU
Post by: dmuntean on January 24, 2012, 16:48:22 PM
Hi pfasshauer,

Yes, I solved this issue for myself. However, I don't really like hacking core files of virtuemart. It makes upgrading more difficult. But this is what you can do:

Open administrator/components/com_virtuemart/models/product.php

Around Line 94 Replace This:
$this->valid_search_fields= array('product_name');
With This:
$this->valid_search_fields= array('product_name','product_sku');
Around Line 132 Replace This:
$valid_search_fields = array('product_name');
With This:
$valid_search_fields = array('product_name','product_sku');


Is this the best way to do this? Probably not. Does it work? Yes.