Post by zaheerali » Tue Oct 17, 2023 7:11 pm

I have a mutil-language (English, Russian, etc.) website based on OpenCart 3.0.3.8 and the Journal 3 theme.

Currently, when using the search bar to search for products, if the user does not input text in the currently active language (let's say English), but in stead, inputs text in any of the other avaiable languages (for example, Russian), then the search will result in nothing being found.

Despite the product that coresponds with the search query being in stock, avaiable and having description translated in multiple-languages, OpenCart only looks for text in the active language translation and only text that matches the search query.

Ideally, I would like to allow users to write their search query in any of the avaiable languages... no matter which one is the active one currenlty and be able to find products.

Any ideas how to accomplish this?

I have looked into the OpenCart support forum and people recommended to modify the product.php (catalogue) file function that supposedly contains the sql queries for fetching products based on search bar input.

For example, inside the getProducts() function I changed the following code...

Code: Select all

$sql = "SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
...to this...

Code: Select all

$sql = "SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id);
I have also removed the pd.language_id restriction in other code blocks, but no matter what changes I introduce inside this file, nothing changes.

It is possible that the Journal 3 theme has it's own files that modify the default search functionality. Yet, the Journal theme documentation states (might be wrong) that Journal 3 uses the default built-in search functionality of OpenCart 3. Thus, modifying the default code responsible for searching prodcuts, should do the trick.

Yet, nothing I have tried, has enabled my site to allow multi-language product search.

Newbie

Posts

Joined
Tue Oct 17, 2023 7:06 pm

Post by IP_CAM » Tue Oct 17, 2023 9:44 pm

Better read this topic, before expecting much, using a commercial Journal Theme, bought outside of OC, and so in no way related to Opencart:
viewtopic.php?t=220036

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 6 guests