Post by popular » Wed Sep 21, 2011 1:11 am

I'm running opencart 1.5.1 with vqmod

I login as an administrator go to catalog -> products
I type "sweater" into the product name box and click filter
Only the item "sweater with stripes" comes up (there are 5 other products with sweater in the name)
The odd thing is that the pagination says Showing 1 to 6 of 6 (1 Pages) however the list only has one item :(

Anyone else experiencing this with 1.5.1?

New member

Posts

Joined
Sun Jul 25, 2010 10:50 pm

Post by uksitebuilder » Wed Sep 21, 2011 4:53 am

Nice spotting, fix below, will move to bugs forum

open: admin/model/catalog/product.php

find

Code: Select all

			if (isset($data['filter_name']) && !is_null($data['filter_name'])) {
				$sql .= " AND LCASE(pd.name) LIKE '" . $this->db->escape(mb_strtolower($data['filter_name'], 'UTF-8')) . "%'";
			}
change to

Code: Select all

			if (isset($data['filter_name']) && !is_null($data['filter_name'])) {
				$sql .= " AND LCASE(pd.name) LIKE '%" . $this->db->escape(mb_strtolower($data['filter_name'], 'UTF-8')) . "%'";
			}
Also if you want to the other sql queries below may also need to be changed too

change

Code: Select all

LIKE '" . $this
to

Code: Select all

LIKE '%" . $this

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by popular » Wed Sep 21, 2011 5:18 am

Worked for me! Thanks!

New member

Posts

Joined
Sun Jul 25, 2010 10:50 pm

Post by kalessaradan » Tue Oct 01, 2013 2:00 am

We are running 1.5.6 and having the same problem. When I do a search for the word ear, nothing is popping up, even though I have 10+ products each containing that word in its title. I found this solution on the forums, but when I did a search for the code,

"if (isset($data['filter_name']) && !is_null($data['filter_name'])) {
$sql .= " AND LCASE(pd.name) LIKE '" . $this->db->escape(mb_strtolower($data['filter_name'], 'UTF-8')) . "%'";
}"

it didn't find that code in the file listed. Any help for a newer version?

New member

Posts

Joined
Tue Aug 17, 2010 12:12 pm

Post by kalessaradan » Tue Oct 01, 2013 3:56 am

Just letting you know, I did the second part of your instructions,

"Also if you want to the other sql queries below may also need to be changed too

change
CODE: SELECT ALL
LIKE '" . $this

to
CODE: SELECT ALL
LIKE '%" . $this

Happy Coding!"

And it all worked! I can now search our Products in the admin section and find stuff again. Thanks!

New member

Posts

Joined
Tue Aug 17, 2010 12:12 pm

Post by nello14 » Fri Feb 28, 2014 2:38 am

I have a somewhat similar problem.
I have OC 1.5.2.1
I insert a new product, its name is

Armadio rack anti effrazione 7 unita' 19" largh.600 prof.600 alt.428 mm--ARM179

notes that there are double quotes after 19,
The product is properly inserted.
If I do a search by filtering the name or by filtering the price, the product is displayed but all characters from the double quotes disappear!

Armadio rack anti effrazione 7 unita' 19

At this point I can not change the product (eg price, quantity, etc.), because if unless the changes the name of the product remains incomplete.
Anyone who knows a solution for this problem?
Thanks

New member

Posts

Joined
Tue Oct 18, 2011 5:04 am

Post by nello14 » Thu Apr 24, 2014 1:54 pm

For now, the only solution is to replace " with ' '

New member

Posts

Joined
Tue Oct 18, 2011 5:04 am
Who is online

Users browsing this forum: No registered users and 3 guests