Skip to Content
2
Former Member
Feb 16, 2015 at 05:30 PM

How do I push a localized enum name to a variant product page?

1059 Views

I've setup a practice shop based off of the accelerator and am trying to achieve the following goals:

  1. Create a new Product model

  2. Create a variant product with an enumerated value

  3. Display a localized enumerated value via a drop-down list on the product page.

Currently, I have my product created and am able to see a drop-down list of values for the variant products, but the drop-down does not appear to be localized. Here are the relevant (I think) code snippets.

         <enumtype code="emergencyResponseEnum" autocreate="true" dynamic="true" generate="true">
             <value code="NONE"/>
             <value code="FIFTEEN_MINUTES"/>
             <value code="THIRTY_MINUTES"/>
             <value code="SIXTY_MINUTES"/>
             <value code="SIX_HOURS"/>
         </enumtype>
 ...
     <maptypes>
         <maptype code="localized:emergencyResponseEnum" argumenttype="Language" returntype="emergencyResponseEnum" autocreate="true" generate="false" />
     </maptypes>
 
 ...
         <itemtype code="ServiceProduct" extends="Product"
                   autocreate="true" generate="true">
             <description>Service Products represent our core packages of development, support, and monitoring</description>
             <deployment table="ServiceProducts" typecode="11337"/>
             <attributes>
                 <attribute qualifier="emergencyResponse" type="localized:emergencyResponseEnum">
                     <description>Rapid response for critical errors in the service.</description>
                     <modifiers/>
                     <persistence type="property"/>
                 </attribute>
             </attributes>
         </itemtype>
 ...
 <itemtype code="EmergencyResponseVariantProduct" extends="VariantProduct"
                   autocreate="true" generate="true"
                   jaloclass="de.hybris.merchandise.core.jalo.EmergencyResponseVariantProduct">
             <description>Emergency Response variant offering guaranteed times for response.
             </description>
             <attributes>
                 <attribute qualifier="emergencyResponseEnum" type="localized:emergencyResponseEnum"
                            metatype="VariantAttributeDescriptor">
                     <description>Guaranteed response time in event of a critical issue.</description>
                     <modifiers/>
                     <persistence type="property"/>
                 </attribute>
             </attributes>
         </itemtype>

In core-locales_en.properties, I've tried the following:

 type.emergencyResponseEnum.NONE.name=None  
 type.EmergencyResponseVariantProduct.emergencyResponseEnum.NONE.name=None  
 type.ServiceProduct.emergencyResponseEnum.NONE.name=None  

And in my products.impex file:

 INSERT_UPDATE ServiceProduct;code[unique=true];$supercategories;manufacturerName;manufacturerAID;unit(code);varianttype(code);ean;$catalogVersion;$approved;$taxGroup
 
  ;1100;310;Core Support Team;SUPPORT-1;pieces;EmergencyResponseVariantProduct
 
 # Create EmergencyResponseVariantProduct variants
 INSERT_UPDATE EmergencyResponseVariantProduct;code[unique=true];$catalogVersion;$baseProduct;unit(code);emergencyResponseEnum(code);supercategories(code,$catalogVersion);$approved
 ;1100_NONE;;1100;pieces;NONE;310;

Finally, in productVariantSelector.tag, I'm attempting to access the value through the list of variantOptions and then using the variantOptionQualifier.name field, which currently displays NONE rather than None.