Post by saliverdim » Fri Nov 24, 2017 10:26 pm

I have 2 product
1-pinpon
2-pınpon
I search pinpon , result 1 :(
I search pınpon , result 1 :(

must result all :(

2.1.0.2 journal

Active Member

Posts

Joined
Wed Oct 07, 2015 12:15 am

Post by straightlight » Fri Nov 24, 2017 10:32 pm

In catalog/model/catalog/product.php file,

replace:

Code: Select all

$implode[] = "pd.name LIKE '%" . $this->db->escape($word) . "%'";
with:

Code: Select all

$implode[] = "pd.name LIKE TRIM(LCASE('%" . $this->db->escape($word) . "%'))";

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by MrPhil » Sat Nov 25, 2017 1:01 am

What's TRIMming '% some term %' going to do? Does TRIM work inside a string, or just leading and trailing blanks (which don't exist here)? Did you mean to trim the search term before wrapping %'s around it?

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm

Post by straightlight » Sat Nov 25, 2017 1:08 am

MrPhil wrote:
Sat Nov 25, 2017 1:01 am
What's TRIMming '% some term %' going to do? Does TRIM work inside a string, or just leading and trailing blanks (which don't exist here)? Did you mean to trim the search term before wrapping %'s around it?
Be reminded that both %, one at the beginning and one at the end, are being used on this query which means that anything from the beginning and the end can be matched. Which is why, trim is implicit with this string search.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by saliverdim » Sun Nov 26, 2017 1:46 am

search in categories and result show ?

can you help me ?

thank you

Active Member

Posts

Joined
Wed Oct 07, 2015 12:15 am

Post by straightlight » Sun Nov 26, 2017 1:52 am

Which OC version?

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by saliverdim » Sun Nov 26, 2017 8:20 am

2.1.0.2
thank you thank you :)

Active Member

Posts

Joined
Wed Oct 07, 2015 12:15 am

Post by MrPhil » Thu Nov 30, 2017 3:07 am

Something I didn't notice before: one is a regular "i", and the other is a "dotless i". Is there a reason for the difference? Was it deliberate? Changing the dotless i to a regular ASCII i might solve the problem, if it was accidental. Otherwise, a regular i and a dotless i won't match in a search. If you want to keep the dotless i, take a look at the page and database encoding -- dotless i is in Unicode Latin Extended-A, and not normally found in a Latin-x code page (at least, not Latin-1). It might have snuck in through Windows CP-125x, around x9D or so ("smart quotes"). Still, I don't see how one can expect the search to return both of them.

Possibly, your database can be configured to treat "i" and "dotless i" the same in searches, but I don't know how to do it. It would probably be something in the selected "collation".

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm

Post by straightlight » Thu Nov 30, 2017 4:30 am

Let's troubleshoot this issue regarding accentuated characters. In system/helper/utf8.php file, at the bottom of fhe file,

find:

Code: Select all

return $string;
	}
replace with:

Code: Select all

return $string;
	}

function removeAccents($value, $language) {
     $code = explode('-', trim($language));
     
     setlocale(LC_ALL, strtolower($code[0]) . "_" . strtoupper($code[1]) . ".utf8"); 
    
    return iconv('UTF-8', 'ASCII//TRANSLIT',$value);
}
Then, in your catalog/model/catalog/product.php file,

find all instances of:

Code: Select all

$implode[] = "pd.name LIKE '%" . $this->db->escape($word) . "%'";
replace all with:

Code: Select all

$implode[] = "pd.name LIKE '%" . $this->db->escape(replaceAccents($word, $this->session->data['language'])) . "%'";
Then, find all instances of:

Code: Select all

$sql .= " OR pd.description LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
replace all with:

Code: Select all

$sql .= " OR pd.description LIKE '%" . $this->db->escape(replaceAccents($data['filter_name'], $this->session->data['language'])) . "%'";
See if that solves the issue.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by MrPhil » Sat Dec 02, 2017 3:16 am

If you have any trouble with the iconv() code, be sure to read http://php.net/manual/en/function.iconv.php. The TRANSLIT may not be supported on all PHP installations, but if it is, it is supposed to transliterate characters to the nearest ASCII equivalent (e.g., ö/ö becomes oe). You should test that dotless i becomes a regular i. Since this is server-side, you don't have to worry about what browsers your customers are using, but if you're on a separate database server, that needs to be checked.

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm

Post by saliverdim » Tue Jan 02, 2018 9:01 am

how to search in sub categories ?

Active Member

Posts

Joined
Wed Oct 07, 2015 12:15 am

Post by straightlight » Tue Jan 02, 2018 9:05 am

saliverdim wrote:
Tue Jan 02, 2018 9:01 am
how to search in sub categories ?
This extension may be useful: https://www.opencart.com/index.php?rout ... n_id=12145

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by saliverdim » Tue Aug 14, 2018 12:13 am

please help me ?

search : pınar aylin found.
search : pinar aylin not found :/

serch : hakkı found
search : hakki not found

can you help me ?

2.0.1.2
jorunal

Active Member

Posts

Joined
Wed Oct 07, 2015 12:15 am

Post by saliverdim » Tue Aug 14, 2018 1:51 am

straightlight wrote:
Thu Nov 30, 2017 4:30 am
Let's troubleshoot this issue regarding accentuated characters. In system/helper/utf8.php file, at the bottom of fhe file,

find:

Code: Select all

return $string;
	}
replace with:

Code: Select all

return $string;
	}

function removeAccents($value, $language) {
     $code = explode('-', trim($language));
     
     setlocale(LC_ALL, strtolower($code[0]) . "_" . strtoupper($code[1]) . ".utf8"); 
    
    return iconv('UTF-8', 'ASCII//TRANSLIT',$value);
}
Then, in your catalog/model/catalog/product.php file,

find all instances of:

Code: Select all

$implode[] = "pd.name LIKE '%" . $this->db->escape($word) . "%'";
replace all with:

Code: Select all

$implode[] = "pd.name LIKE '%" . $this->db->escape(replaceAccents($word, $this->session->data['language'])) . "%'";
Then, find all instances of:

Code: Select all

$sql .= " OR pd.description LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
replace all with:

Code: Select all

$sql .= " OR pd.description LIKE '%" . $this->db->escape(replaceAccents($data['filter_name'], $this->session->data['language'])) . "%'";
See if that solves the issue.
thank you but, 1.steps after website not working :((

and very very hard.

another fix ?

ı use ısearchcortable but same problem :((

ı try 2 years

2.0.1.2

Active Member

Posts

Joined
Wed Oct 07, 2015 12:15 am

Post by Johnathan » Tue Aug 14, 2018 9:44 pm

This is probably a database encoding issue, not an OpenCart code issue. Make sure your database is set to have a collation of "utf8_unicode_ci", so that it works with non-English characters, and can see them as the equivalent English character when entered. If it's not, here's the database query you'd run to change that collation:

Code: Select all

ALTER TABLE oc_product_description CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Make sure you replace "oc_" with your database prefix.

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by saliverdim » Thu Aug 16, 2018 4:21 am

Johnathan wrote:
Tue Aug 14, 2018 9:44 pm
This is probably a database encoding issue, not an OpenCart code issue. Make sure your database is set to have a collation of "utf8_unicode_ci", so that it works with non-English characters, and can see them as the equivalent English character when entered. If it's not, here's the database query you'd run to change that collation:

Code: Select all

ALTER TABLE oc_product_description CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Make sure you replace "oc_" with your database prefix.
hi again,
ı use utf8 general_ci
I tried convert your code but now he does not find anything. :((

Active Member

Posts

Joined
Wed Oct 07, 2015 12:15 am

Post by Johnathan » Thu Aug 16, 2018 5:22 am

If utf8_unicode_ci doesn't work, then switch back to utf8_general_ci. However, the database encoding is still likely the issue, so you should look into that, or hire someone with more experience to look into it for you. You may have other database encoding issues going on, which could be causing conflicts.

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by saliverdim » Thu Aug 16, 2018 5:26 am

Johnathan wrote:
Thu Aug 16, 2018 5:22 am
If utf8_unicode_ci doesn't work, then switch back to utf8_general_ci. However, the database encoding is still likely the issue, so you should look into that, or hire someone with more experience to look into it for you. You may have other database encoding issues going on, which could be causing conflicts.
thank you but I think the problem is in OpenCart itself.because i looked with isenslab isearchcortable extentions and ı tryed ı = i and worked.but this does not work for me.because this time i can not find the letters "i" :/

Active Member

Posts

Joined
Wed Oct 07, 2015 12:15 am

Post by straightlight » Thu Aug 16, 2018 6:21 am

Updated instructions from my previous post.

Replace:

Code: Select all

$implode[] = "pd.name LIKE TRIM(LCASE('%" . $this->db->escape($word) . "%'))";
with:

Code: Select all

$implode[] = "pd.name LIKE TRIM(LCASE('%" . $this->db->escape($word) . "%')) COLLATE utf8_general_ci";
to search LONGBLOB field types. Looks for case sensitive but not accent sensitive: https://stackoverflow.com/questions/500 ... h-in-mysql

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by saliverdim » Thu Aug 16, 2018 9:56 am

straightlight wrote:
Thu Aug 16, 2018 6:21 am
Updated instructions from my previous post.

Replace:

Code: Select all

$implode[] = "pd.name LIKE TRIM(LCASE('%" . $this->db->escape($word) . "%'))";
with:

Code: Select all

$implode[] = "pd.name LIKE TRIM(LCASE('%" . $this->db->escape($word) . "%')) COLLATE utf8_general_ci";
to search LONGBLOB field types. Looks for case sensitive but not accent sensitive: https://stackoverflow.com/questions/500 ... h-in-mysql
thank you but, 1.steps after website not working :(( first for you message.. :(
and after ı tryed only here your message but problem not resolve :(

catalog/model/catalog/product file : https://we.tl/Kz2PNHcCMq
catalog/model/catalog/isearch file : https://we.tl/Kz2PNHcCMq


I need :
i = ı and ı = i
and
lower case sameone in search.
please :((

Active Member

Posts

Joined
Wed Oct 07, 2015 12:15 am
Who is online

Users browsing this forum: Baidu [Spider] and 7 guests