News:

Looking for documentation? Take a look on our wiki

Main Menu

Searching product_sku

Started by globalhenkie, May 17, 2013, 09:17:05 AM

Previous topic - Next topic

globalhenkie

Hi,

I'm using Joomla! 2.5.11 and VM 2.0.20b
I've got a database with articles which have a unique number (product_sku).
I want to search on that number but it fails.
The number looks like this 1000.2130, 7705.4117 etc.
With a dot in the middle.
Everytime a type a number in the virtuemart searchbox it returns the given number without dot and no results.
When I type a part of the number (before or after the dot) it works. But I want to search on the total number.
I know there is a hack in VM1 but I can't find it in VM2.

Henk

gain

My solution
--- administrator/components/com_virtuemart/models/product.php.orig     2014-02-20 12:05:58.608424337 +0100
+++ administrator/components/com_virtuemart/models/product.php  2014-02-20 12:05:24.200433538 +0100
@@ -128,9 +128,11 @@
        function updateRequests () {

                //hmm how to trigger that in the module or so?
-               $this->keyword = vmRequest::uword ('keyword', "0", ' ,-,+');
+               $this->keyword = JRequest::getVar ('keyword', "0");
                if ($this->keyword == "0") {
-                       $this->keyword = vmRequest::uword ('filter_product', "0", ' ,-,+');
+                       $this->keyword = JRequest::getVar ('filter_product', "0");
                }

                $app = JFactory::getApplication ();

gain

Hi,
relating to my previous post, I'm wondering why VirtueMart removes ' ,-,+' characters from keyword.
Maybe for security?

Let me know.

Thanks in advance.

Jazajay

Hi
Certain characters such as: "." "+" "-", have special meaning when used in queries and regular expressions.

Try escaping the: ".", when you search.

So change this: 1000.2130, to: 1000\.2130

That said if that doesn't work, then I would report this as a bug - because this should be a simple fix using escape special character functions - over we will remove it from being searched entirely. :)