Color variant adapt wrong word in Danish

  • Posts: 51
  • Thank you received: 4
4 years 5 months ago #313072

-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.13
-- PHP version -- : 7.2.24

I have a very, very strange issue here:

I am working with a product with several characteristics. One characteristic is five color variants, one one is black. The Danish word for black is "sort", but somehow the word "sort" is changed to "sortér". This is very strange, but more strange is, that if I change the language in the back-end to be English, the the Danish word for black is displayed correct!!!

I have attached some screen dumps to illustrate this strange issue. Here you can see, that the word "sort" is spelled correct , but somehow manage to be replaced by the word "sortér".

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
4 years 5 months ago #313078

Hi,

I suppose that it's because we've added the possibility of translation overrides for characteristic values.
So during the display on the frontend, HikaShop search for a corresponding translation key and if it founds one, it replaces it.
So you must have a translation key like this in one of the loaded translation files:
SORT="Sortér"
To avoid that, you can change the text to something else, like for example: MY_SORT
And then add such translation override:
MY_SORT="Sort"

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

  • Posts: 51
  • Thank you received: 4
4 years 5 months ago #313112

It is correct, that I have a SORT="Sortér" string in the Danish language file.

So now I have change the characteristic value "Sort" to "Min_Sort" and I have added the string MIN_SORT="Sort" in the Danish language file.

Now it works in the back-end, but in the front-end it still display "Sortér" instead of "Sort" in the color selector, but, and this is strange, in the text in the upper part of the product picture, is says "Sort" like it should!?!?

Any idea why?

Attachments:
Last edit: 4 years 5 months ago by anders.drejer.

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
4 years 5 months ago #313229

Hi,

I did some tests and found the issue.
It's because the system does the translation override twice in that case. One when the variant name is generated (for the display of the product name), and once when the characteristic dropdown selector is generated.

By changing the code:

if(strpos($val->characteristic_value, '<') === false)
							$val->characteristic_value = hikashop_translate($val->characteristic_value);
						$variant->characteristics_text .= $separator . $val->characteristic_value;
to:
$char_value = $val->characteristic_value;
						if(strpos($char_value, '<') === false)
							$char_value = hikashop_translate($char_value);
						$variant->characteristics_text .= $separator . $char_value;
in the file administrator/components/com_hikashop/classes/product.php I was able to fix the problem.
Please do the change and it should work properly for you too.
We'll add that change on our end too.

The following user(s) said Thank You: anders.drejer

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

Time to create page: 0.104 seconds
Powered by Kunena Forum