cancel
Showing results for 
Search instead for 
Did you mean: 

Load Interceptor : Why Are Localized Attributes Not Rendering on hMC / PCM Until Changing an Attribute Value and Explicitly Saving

Former Member
0 Kudos

I've implemented a LoadInterceptor to fill in ProductModel images if certain conditions exist. Everything works correctly except for one aspect: If you view a product item within the hMC or Product Cockpit, you won't see values populated for certain localized attributes (name, description, etc.). However, if you do a Flexible Search to see what's in the database, these attribute values are returned as expected. Two things that are even more interesting:

  1. If you go ahead and edit another product property (let's say Product.code or Product.approvalStatus) and save it, the hMC / PCM will then render the missing attributes.

  2. I've only seen this issue with localized strings. Note that Product.keywords actually works just fine (Product2KeywordRelation).

It's probably a lazy-loading or caching issue, or it could potentially be an interceptor ordering issue. Note that I do not touch or modify the localized attributes in my interceptor; I'm only injecting media on certain conditions.

For reference, here's my Spring configuration:

 <!-- Notes: See https://wiki.hybris.com/display/release5/Interceptors for details -->
 <bean id="customProductImageLoadInterceptor" class="com.mypackage.CustomProductImageLoadInterceptor" autowire="byName" />
 <bean id="customProductImageLoadInterceptorMapping" class="de.hybris.platform.servicelayer.interceptor.impl.InterceptorMapping">
     <property name="interceptor" ref="customProductImageLoadInterceptor"/>
     <property name="typeCode" value="Product"/>
 </bean>

Let me know if you have any thoughts or suggestions! I'd be happy to provide more details if necessary.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Please see https://jira.hybris.com/browse/ECP-347 for the bug report.

Former Member
0 Kudos

As a temporary workaround, I've added the following code at the end of my onLoad implementation, and this takes care of refreshing all the localized attribute values:

@Override public void onLoad(final ProductModel productModel, final InterceptorContext interceptorContext) throws InterceptorException

{

....productModel.setName(productModel.getName(Locale.US), Locale.US);

}