Page 1 of 1

search when multi-language...

Posted: Mon Feb 15, 2016 4:36 pm
by masterbeta
so i have 2 languages on my opencart site, when in English i can search in English of course and see results in English....

when i search with other language, i can only search in that other language, i cannot search in English...

i would like to have that whatever language i have installed, to search with either language to return the same results in the current language - so for example, if i'm viewing the store in a foreign language, and i search in English, i would like the search to return the products in the current language instead of "0 products found" message.... i figured this should be a simple "fix" since the search controller parses the database - can anyone recommend a simple way to make this happen?

thanks

Re: search when multi-language...

Posted: Thu Feb 25, 2016 3:18 pm
by masterbeta
on line 78 in model/catalog/product.php
i removed the language part of this:

Code: Select all

$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";
to this:

Code: Select all

$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";
now i can search whatever words in any language

Re: search when multi-language...

Posted: Mon Jun 25, 2018 4:05 am
by Nawid
Thx, it works on Opencart Version 3.0.2.0

Re: search when multi-language...

Posted: Mon Jun 25, 2018 4:30 am
by IP_CAM
It also works in later 1.5.6.x Versions, as it looks. ;)
Just to have this mentioned too ...
Ernie

Re: search when multi-language...

Posted: Mon Feb 04, 2019 12:23 pm
by gangerlino
Worked for opencart 2.3.0.2

Re: search when multi-language...

Posted: Sun Aug 08, 2021 6:04 am
by IliaM
Hello,

I've modified lines mentioned above, but no changes yet.
Is there any time needed for changes?

Re: search when multi-language...

Posted: Sun Aug 08, 2021 6:22 am
by thekrotek
IliaM wrote:
Sun Aug 08, 2021 6:04 am
Is there any time needed for changes?
No, you just did it wrong.

Re: search when multi-language...

Posted: Sun Aug 08, 2021 6:55 am
by IliaM
I double checked and it looks good. Clear caches is not helping as well. :(

Re: search when multi-language...

Posted: Sun Aug 08, 2021 6:57 am
by thekrotek
IliaM wrote:
Sun Aug 08, 2021 6:55 am
I double checked and it looks good. Clear caches is not helping as well. :(
Then it works fine, if you did everything right! Right???!

Re: search when multi-language...

Posted: Sun Aug 08, 2021 7:03 am
by IliaM
thekrotek wrote:
Sun Aug 08, 2021 6:57 am
IliaM wrote:
Sun Aug 08, 2021 6:55 am
I double checked and it looks good. Clear caches is not helping as well. :(
Then it works fine, if you did everything right! Right???!
No.
I did not say that I did everything right, I just said, that I change those code mentioned above.
I am just wondering if there is something else.

Re: search when multi-language...

Posted: Fri Dec 03, 2021 5:04 am
by moshair
Thx, it works on Opencart Version 3.0.3.8