How to loop a "Multiple String" from a ProductBO object in an ISML-Template?

284 views Asked by At

How can I loop a Multiple String from a ProductBO object? What is the best way to do this?

1

There are 1 answers

0
Lachezar Balev On

As long as you know the name of the attribute you may use the following method on ProductBO from within an ISML:

public AttributeValue getAttributeValue(String aName);

The storefront app comes with a convenient albeit not extremely flexible module that is able to display AV-s. It works for multiple attributes too. The name of the module is ISCustomAttribute.

Sample usage:

<isCustomAttribute 
    attributelabel="#AttributeDescriptor:DisplayName#" 
    attributevalue="#ProductBO:AttributeValue(AttributeDescriptor:ID)#" 
    attributeseparator=",&nbsp;">

The best would be if you use this module. You may see it in action. Custom ProductBO attributes are printed on the product details page in the storefront as the next image shows (@see DetailsTab.isml):

enter image description here

If this does not fit, you will have to retrieve the attribs as something iterable. The way I think fits best is to use the BO extension BusinessObjectAttributes. You will be able retrieve a BusinessObjectAttribute by name from it and loop through its value.

<isloop iterator="BusinessObjectAttribute:Value" alias="AValue" counter="counter">
    <!--- Do something gorgeous here --->
</isloop>