- Posts: 48
- Thank you received: 6
Restrict search results to currently set language
1 month 3 weeks ago #100000033
by NTV
Restrict search results to currently set language was created by NTV
-- HikaShop version -- : 6.6.0
-- Joomla version -- : 6.1.3
-- PHP version -- : 8.3.6
-- Browser(s) name and version -- : Firefox 156.0
Hi,
I have a website that currently supports two languages: German and English.
I want to restrict search results to show only our English products when the language is set to English and vice-versa.
I checked the Smart Search Index and saw that each search result has a language value.
How do I set these values correctly for HikaShop products and then filter my results accordingly?
Thanks in advance.
-- Joomla version -- : 6.1.3
-- PHP version -- : 8.3.6
-- Browser(s) name and version -- : Firefox 156.0
Hi,
I have a website that currently supports two languages: German and English.
I want to restrict search results to show only our English products when the language is set to English and vice-versa.
I checked the Smart Search Index and saw that each search result has a language value.
How do I set these values correctly for HikaShop products and then filter my results accordingly?
Thanks in advance.
Please Log in or Create an account to join the conversation.
1 month 3 weeks ago #100000040
by nicolas
Replied by nicolas on topic Restrict search results to currently set language
Hello,
HikaShop products don't have a language of their own: the "Smart Search - HikaShop Products" plugin indexes each product for every language, which is why your German and English books appear in the search of both languages. On a multilingual site, Joomla's Smart Search already shows only the content of the current language, so what is missing is the language information on the products.
We have added this in the next version of HikaShop, 6.7.0 which will be released in October. In the translation popup of a product (the language flags at the top of the product edit form), there is now a "Hide in this language" checkbox. A product hidden in a language is left out of the product listings and of the Smart Search results in that language, its page answers "product not found", and it can't be added to the cart there. Its variants follow it.
Once you have updated to 6.7.0:
1. In Components > HikaShop > System > Configuration, in the Languages section, set "Activate the edition of content in multiple languages" to Yes, so that the translation popups of the products appear.
2. For each German book, open its English translation popup and tick "Hide in this language". For each English book, do the same in its German translation popup. Leave the products that should appear in both languages as they are.
3. In Components > Smart Search, clear the index and index again.
The English search will then only list your English books (and the products you didn't hide), and the German search only the German ones.
This isn't possible yet in your current version 6.6.0. Product translations need the Essential or Business edition of HikaShop.
HikaShop products don't have a language of their own: the "Smart Search - HikaShop Products" plugin indexes each product for every language, which is why your German and English books appear in the search of both languages. On a multilingual site, Joomla's Smart Search already shows only the content of the current language, so what is missing is the language information on the products.
We have added this in the next version of HikaShop, 6.7.0 which will be released in October. In the translation popup of a product (the language flags at the top of the product edit form), there is now a "Hide in this language" checkbox. A product hidden in a language is left out of the product listings and of the Smart Search results in that language, its page answers "product not found", and it can't be added to the cart there. Its variants follow it.
Once you have updated to 6.7.0:
1. In Components > HikaShop > System > Configuration, in the Languages section, set "Activate the edition of content in multiple languages" to Yes, so that the translation popups of the products appear.
2. For each German book, open its English translation popup and tick "Hide in this language". For each English book, do the same in its German translation popup. Leave the products that should appear in both languages as they are.
3. In Components > Smart Search, clear the index and index again.
The English search will then only list your English books (and the products you didn't hide), and the German search only the German ones.
This isn't possible yet in your current version 6.6.0. Product translations need the Essential or Business edition of HikaShop.
The following user(s) said Thank You: NTV
Please Log in or Create an account to join the conversation.
1 month 3 weeks ago #100000055
by NTV
Replied by NTV on topic Restrict search results to currently set language
Hi,
cool that the feature is coming in the next version.
Will it be possible to set this via mass action?
We have a lot of products which would mean a lot of manual labor, otherwise.
cool that the feature is coming in the next version.
Will it be possible to set this via mass action?
We have a lot of products which would mean a lot of manual labor, otherwise.
Please Log in or Create an account to join the conversation.
1 month 3 weeks ago #100000056
by nicolas
Replied by nicolas on topic Restrict search results to currently set language
Hi,
Yes, this can be done in bulk, with the mass actions already built into HikaShop's product listing (Components > HikaShop > Products, select the products, then Actions), once you are on 6.7.0; no extra development is needed for it.
If you can select your German books and your English books separately, for example by category, the quickest way is the "Update the values" action: choose the column product_hidden_languages, set the type to "A text", and enter ,en-GB, to hide the selection in English or ,de-DE, to hide it in German, then run it on the whole selection at once.
If each product needs a different value, use "Export CSV" instead: pick the columns product_code and product_hidden_languages, download the file, fill in the value for each line in a spreadsheet, then bring it back in with the "CSV import" action and tick Save.
To hide a product in several languages, put them all in the same value, for example ,de-DE,fr-FR,.
The codes must match the language tags used on your site, which you can check under System > Languages in Joomla, commonly en-GB and de-DE.
Also, if you use Smart Search, you'll have to delete the index and reindex in the Smart Search component.
Yes, this can be done in bulk, with the mass actions already built into HikaShop's product listing (Components > HikaShop > Products, select the products, then Actions), once you are on 6.7.0; no extra development is needed for it.
If you can select your German books and your English books separately, for example by category, the quickest way is the "Update the values" action: choose the column product_hidden_languages, set the type to "A text", and enter ,en-GB, to hide the selection in English or ,de-DE, to hide it in German, then run it on the whole selection at once.
If each product needs a different value, use "Export CSV" instead: pick the columns product_code and product_hidden_languages, download the file, fill in the value for each line in a spreadsheet, then bring it back in with the "CSV import" action and tick Save.
To hide a product in several languages, put them all in the same value, for example ,de-DE,fr-FR,.
The codes must match the language tags used on your site, which you can check under System > Languages in Joomla, commonly en-GB and de-DE.
Also, if you use Smart Search, you'll have to delete the index and reindex in the Smart Search component.
Please Log in or Create an account to join the conversation.
3 hours 21 minutes ago #100000814
by NTV
Replied by NTV on topic Restrict search results to currently set language
Hi,
we updated to 6.8.2.
Then, I completed the three steps you mentioned for one english product with the following results:
-SmartSearch still generates only one index entry for the product. Its Language is set to 'All'
-This link works when the site is toggled to English and gives a 404 when toggled to German
Did I do something wrong? Is there a bug?
we updated to 6.8.2.
Then, I completed the three steps you mentioned for one english product with the following results:
-SmartSearch still generates only one index entry for the product. Its Language is set to 'All'
-This link works when the site is toggled to English and gives a 404 when toggled to German
Did I do something wrong? Is there a bug?
Please Log in or Create an account to join the conversation.
6 minutes ago #100000815
by nicolas
Replied by nicolas on topic Restrict search results to currently set language
Hello,
You didn't do anything wrong in the steps, and the frontend part is working on your site: the product page answers 404 in German, which only happens when HikaShop sees the product as hidden in German with the translation of products active.
What doesn't match is the Smart Search index. With "Activate the edition of content in multiple languages" set to Yes and two published content languages, the "Smart Search - HikaShop Products" plugin no longer creates one entry with the language "All": it creates one entry per language (one with English (en-GB) and one with German (de-DE)), and none in a language where the product is hidden. We tested this on a Joomla site with HikaShop 6.8.2: after clearing the index and indexing again, a product hidden in one language only has an entry in the other language, and the other products have one entry per language. An entry with the language "All" is what the plugin makes when it doesn't see several languages to index for, which is why your index looks like it did before the update. On your public site, the German search still lists the English edition of the Python regius book, so this is the case for your other products too, not only the one you hid.
To find what differs on your site, could you check and tell us:
1. In Components > Smart Search, do you start the indexing with the Index button in the toolbar after Maintenance > Clear Index, or is it done by a cron job or the command line (php cli/joomla.php finder:index)?
2. In System > Manage > Content Languages, are both English and German published, and which language codes do they have?
3. In System > Manage > Plugins, search for "Smart Search": is "Smart Search - HikaShop Products" enabled, and is there any other Smart Search plugin for HikaShop products?
4. Do you use Falang or another translation extension on the site?
5. After Clear Index and Index, in Components > Smart Search > Index, search for the title of one product you did not hide: does it show one line with "All", or two lines, one for English and one for German?
With these answers we can tell you what to change, or fix it if it's a problem on our side.
You didn't do anything wrong in the steps, and the frontend part is working on your site: the product page answers 404 in German, which only happens when HikaShop sees the product as hidden in German with the translation of products active.
What doesn't match is the Smart Search index. With "Activate the edition of content in multiple languages" set to Yes and two published content languages, the "Smart Search - HikaShop Products" plugin no longer creates one entry with the language "All": it creates one entry per language (one with English (en-GB) and one with German (de-DE)), and none in a language where the product is hidden. We tested this on a Joomla site with HikaShop 6.8.2: after clearing the index and indexing again, a product hidden in one language only has an entry in the other language, and the other products have one entry per language. An entry with the language "All" is what the plugin makes when it doesn't see several languages to index for, which is why your index looks like it did before the update. On your public site, the German search still lists the English edition of the Python regius book, so this is the case for your other products too, not only the one you hid.
To find what differs on your site, could you check and tell us:
1. In Components > Smart Search, do you start the indexing with the Index button in the toolbar after Maintenance > Clear Index, or is it done by a cron job or the command line (php cli/joomla.php finder:index)?
2. In System > Manage > Content Languages, are both English and German published, and which language codes do they have?
3. In System > Manage > Plugins, search for "Smart Search": is "Smart Search - HikaShop Products" enabled, and is there any other Smart Search plugin for HikaShop products?
4. Do you use Falang or another translation extension on the site?
5. After Clear Index and Index, in Components > Smart Search > Index, search for the title of one product you did not hide: does it show one line with "All", or two lines, one for English and one for German?
With these answers we can tell you what to change, or fix it if it's a problem on our side.
Please Log in or Create an account to join the conversation.
Time to create page: 0.056 seconds