cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Create classification feature attribute of type Country

Former Member
0 Likes
701

We have a requirement to create classification attribute of type multi-valued country list. So in the backoffice when the user navigates to Products -> Attributes, he should be able to view multi-valued attribute and he should be able to select country from the drop down and save the classification attributes. How can we achieve this?

Thanks in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member

Found the below solution:

In the above solution suggested by no need to create ClassificationAttributeValue, instead use the Reference to Country in the class attribute assignment:

INSERT_UPDATE ClassAttributeAssignment;$class;$attribute;multiValued;attributeType(code);localized[default=true];referenceType(code) ;customClass;customAttributeCountry;TRUE;reference;FALSE;Country;

geffchang
Active Contributor
0 Likes

Good to know that you have solved your problem. Feel free to Accept your own answer or mine, so that we can consider this question as answered. :)

geffchang
Active Contributor
0 Likes

You can define a custom enumeration / values, and assign it to the attribute:

 $SYSTEM=customSystem
 $SYSVER=systemVersion(catalog(id),version)[unique=true,default=$SYSTEM:1.0]
 $CATVER=catalogversion(catalog(id),version)[unique=true,default=$SYSTEM:1.0]
 
 # Create classification category
 INSERT_UPDATE ClassificationClass;code[unique=true];name[lang=en];$SYSVER
 ;customClass;Custom Class
 
 # Create classification attribute
 INSERT_UPDATE ClassificationAttribute;code[unique=true];name[lang=en];$SYSVER
 ;customAttributeCountry;Custom Attribute;
 
 # Create enumeration (e.g. for Country)
 INSERT_UPDATE ClassificationAttributeValue;code[unique=true];name[lang=en];$SYSVER
 ;Country;Country_PH;Philippines
 ;Country;Country_JP;Japan
 
 $class=classificationClass(code,$CATVER)[unique=true]
 $attribute=classificationAttribute(code,$SYSVER)[unique=true]
 
 # Define multivalued enum attribute, mapped to classification class
 INSERT_UPDATE ClassAttributeAssignment;$class;$attribute;multiValued;attributeType(code);localized[default=true];attributeValues(code,$SYSVER);
 ;customClass;customAttributeCountry;TRUE;enum;FALSE;Country_PH,Country_JP;
geffchang
Active Contributor
0 Likes

If it's good enough for you, please don't forget to Upvote and Accept the answer. :)