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:
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.
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.