on 06-20-2014 7:01 PM
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.
Please see https://jira.hybris.com/browse/ECP-347 for the bug report.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.