Skip to main content

Restrict search results to currently set language

More
2 weeks 6 days ago #100000033 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.

Please Log in or Create an account to join the conversation.

More
2 weeks 5 days ago #100000040 by nicolas
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.
The following user(s) said Thank You: NTV

Please Log in or Create an account to join the conversation.

More
2 weeks 4 days ago #100000055 by NTV
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.

Please Log in or Create an account to join the conversation.

More
2 weeks 4 days ago #100000056 by nicolas
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.

Please Log in or Create an account to join the conversation.

Time to create page: 0.103 seconds
Powered by Kunena Forum