on ‎2018 Apr 03 10:55 AM
Hi, community. I want a facet boolean in my search page and I need True/False label to have an attribute localized in a base_.properties* files, if it's possible from a storefront module.
I have this in hymodulecore:
public class SellableFacetDisplayNameProvider extends AbstractFacetValueDisplayNameProvider {
private static final String SELLABLE = "facet.sellable";
private static final String NOT_SELLABLE = "facet.notsellable";
private MessageSource messageSource;
private I18NService i18NService;
@Override
public String getDisplayName(final SearchQuery query, final IndexedProperty property, final String facetValue) {
if (StringUtils.equals(String.valueOf(Boolean.TRUE), facetValue)) {
return messageSource.getMessage(SELLABLE, null, i18NService.getCurrentLocale());
}
if (StringUtils.equals(String.valueOf(Boolean.FALSE), facetValue)) {
return messageSource.getMessage(NOT_SELLABLE, null, i18NService.getCurrentLocale());
}
return facetValue;
}
And the Spring declaration:
<bean id="sellableFacetValueDisplayNameProvider"
class="sr.hybris.core.service.search.solrfacetsearch.provider.impl.SellableFacetDisplayNameProvider" >
<property name="i18NService" ref="defaultI18NService"/>
<property name="messageSource" ref="messageSource"/>
</bean>
When loading Messagesource the error is that it does not find the specific property, not even in the hymodulecore.
I know this MessageSource doesn't similar to StorefrontMessageSource, but I can't load this last. Can I do this? Am I on the right?
Thanks!
Regards, Ismael
Request clarification before answering.
I would recommend to better use the "languageQulaifierProvider" to support different languages in indexing. please refer to https://help.hybris.com/6.6.0/hcd/8c7dea5386691014aceaa6b5ab3e31b9.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 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.