Page 1 of 1
Search function not working on Release: v1.5.1
Posted: Mon Jul 18, 2011 11:15 pm
by sonnyp
Hello All,
this is my first post so be gentle.
I've just installed Opencart, everything seems fine (although I've still only just set it up) apart from the search function..
if i search for any keyword i get this error:
Fatal error: Call to undefined function mb_strtolower() in /home/spdweb/public_html/fever_store/catalog/model/catalog/product.php on line 397
but if i search hit search with nothing in the field it will take me to the search result page.
can anyone help?
Thank you.
Sonny
Search function not working on Release: v1.5.1
Posted: Tue Jul 19, 2011 12:34 am
by uksitebuilder
[If you get this error:]
Fatal error: Call to undefined function: mb_strtolower() in

?.php on line ??
The PHP mbstring extension, which is required to handle international character sets, is not available on your server. Check your PHP configuration and make sure that PHP has been compiled with --enable-mbstring.
Re: Search function not working on Release: v1.5.1
Posted: Tue Jul 19, 2011 12:42 am
by SXGuy
uksitebuilder wrote:[If you get this error:]
Fatal error: Call to undefined function: mb_strtolower() in

?.php on line ??
The PHP mbstring extension, which is required to handle international character sets, is not available on your server. Check your PHP configuration and make sure that PHP has been compiled with --enable-mbstring.
In short. contact your webhost and ask them if mbstring is enabled.
Re: Search function not working on Release: v1.5.1
Posted: Tue Jul 19, 2011 12:59 am
by Daniel
i'm going to change this now.
use mysql's LCASE instead.
Re: Search function not working on Release: v1.5.1
Posted: Tue Jul 19, 2011 1:06 am
by Daniel
fixed in svn. also re-uploading 1.5.1 with the fixes in.
Re: Search function not working on Release: v1.5.1
Posted: Tue Jul 19, 2011 1:15 am
by i2Paq
Daniel wrote:fixed in svn. also re-uploading 1.5.1 with the fixes in.
Maybe you should use the SVN version number where this is fixt, I just download the SVN-486 and have no search error.
I see that the SVN is now 487 but I do not know if this is the version where the search is fixt.
Re: Search function not working on Release: v1.5.1
Posted: Tue Jul 19, 2011 1:56 am
by Daniel
Re: Search function not working on Release: v1.5.1
Posted: Tue Jul 19, 2011 7:59 am
by rsmck
I'm still finding search is not working in the latest released 1.5.1 (and SVN r487)
Code: Select all
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY p.product_id ORDER BY p.sort_order ASC LIMIT 0,15' at line 1
Error No: 1064
SELECT p.product_id, (SELECT AVG(rating) AS total FROM review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM product p LEFT JOIN product_description pd ON (p.product_id = pd.product_id) LEFT JOIN product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '1' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '0' AND (LCASE(pd.name) LIKE LCASE('%your-search-here%') OR p.product_id IN (SELECT pt.product_id FROM product_tag pt WHERE pt.language_id = '1' AND LCASE(pt.tag) LIKE LCASE('%your-search-here%')) GROUP BY p.product_id ORDER BY p.sort_order ASC LIMIT 0,15
Re: Search function not working on Release: v1.5.1
Posted: Tue Jul 19, 2011 8:19 am
by rsmck
Seems a few errors crept in when changing from mb function to LCASE (was it really a good idea to REPLACE the working version with one from SVN without any change to version numbering - there must be several different 1.5.1 'releases' out there by now.
The following diff applied to model/catalog/product.php will correct the search, I have not tested any of the other files that were changed (yet) in the most recent SVN.
Code: Select all
74c74
< $sql .= " AND (LCASE(pd.name) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%') OR p.product_id IN (SELECT pt.product_id FROM " . DB_PREFIX . "product_tag pt WHERE pt.language_id = '" . (int)$this->config->get('config_language_id') . "' AND LCASE(pt.tag) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%') OR LCASE(pd.description) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%'))";
---
> $sql .= " AND (LCASE(pd.name) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%') OR p.product_id IN (SELECT pt.product_id FROM " . DB_PREFIX . "product_tag pt WHERE pt.language_id = '" . (int)$this->config->get('config_language_id') . "' AND LCASE(pt.tag) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%') OR LCASE(pd.description) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%')))";
76c76
< $sql .= " AND (LCASE(pd.name) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%') OR p.product_id IN (SELECT pt.product_id FROM " . DB_PREFIX . "product_tag pt WHERE pt.language_id = '" . (int)$this->config->get('config_language_id') . "' AND LCASE(pt.tag) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%'))";
---
> $sql .= " AND (LCASE(pd.name) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%') OR p.product_id IN (SELECT pt.product_id FROM " . DB_PREFIX . "product_tag pt WHERE pt.language_id = '" . (int)$this->config->get('config_language_id') . "' AND LCASE(pt.tag) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%')))";
395c395
< $sql .= " AND (LCASE(pd.name) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%') OR p.product_id IN (SELECT pt.product_id FROM " . DB_PREFIX . "product_tag pt WHERE pt.language_id = '" . (int)$this->config->get('config_language_id') . "' AND LCASE(pt.tag) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%')) OR LCASE(pd.description) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%'))";
---
> $sql .= " AND (LCASE(pd.name) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%') OR p.product_id IN (SELECT pt.product_id FROM " . DB_PREFIX . "product_tag pt WHERE pt.language_id = '" . (int)$this->config->get('config_language_id') . "' AND LCASE(pt.tag) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%')) OR (LCASE(pd.description) LIKE LCASE('%" . $this->db->escape($data['filter_name']) . "%')))";
Re: Search function not working on Release: v1.5.1
Posted: Tue Jul 19, 2011 11:02 am
by scott23
I'm seeing the same error as you when attempting the search function. And your fix appears to work except for if you choose the search in product descriptions box.
Scott
Re: Search function not working on Release: v1.5.1
Posted: Tue Jul 19, 2011 12:53 pm
by Daniel
just fixed it on svn:
http://code.google.com/p/opencart/source/detail?r=489
i have also re-released 1.5.1 as this is a pretty bad bug.