Missing product attribute translations

In this post, I will explain a little bit more about the translations a customer can make use of on the products and attributes in the system. From a user point of view, it is very simple. There is a translation button available that one can click and then add the required translations. From a technical point of view though, it is less simple due to the translations being located in different tables.  Getting the required translation, one has to understand how all this functionality is implemented. So where are my missing product attribute translations?

The short description below explains the entities and their related translation.

Source translation
EcoResProduct EcoResProductTranslation
EcoResAttribute EcoResAttributeTranslation
EcoResCategory EcoResCategoryTranslation
RetailAffiliation RetailAffiliationTranslation

 

The EcoResValue table is not straight forward, and is also the reason why I am writing this blog article

Source translation
EcoResValue Depends if it is an enumeration

 

This table supports derived tables, and for every type, there is a derived one. (see picture below)

Missing product attribute translations

So depending on the derived table, there is a different translation. Please note that there are no translations on int or float datatypes.

There exists a method named getValueAsText (LanguageId _languageId = ”) on the table EcoResValue. Depending on the derived table, the behavior is adapted, but this does not work in case the EcoResTextValue is part of a fixed list (picture below from functional point of view)

Missing product attribute translations

In this case, the translation is not correct. To get the correct translation one has to follow a strange combination of tables. One has to look into table EcoResEnumerationAttributeTypeValue, with two different calls.

The first call to look with the current value in this table and return the position in my fixed list.

The second step is to find the EcoResValue that belongs to the fixed list in question. With this EcoResValue a translation from EcoResTextValueTranslation is obtained.

 

solution

if(EcoResAttributeType.IsEnumeration)

{

int number = EcoResEnumerationAttributeTypeValue::attributeTypeAndValue2EnumValue(EcoResAttributeType.recid,common);

RefRecId RefRecId = EcoResEnumerationAttributeTypeValue::findByOrdinalNumber(EcoResAttributeType.RecId,number).Value;

EcoResValue common = EcoResValue::find(RefRecId);

}

 

My personal opinion is that the above piece of code is missing in the function getValueAsText of the EcoResTextValue. However, as usual, it is in MS’s hands to decide.

 

Comments1

Leave a Comment!

Your email address will not be published. Required fields are marked *