简体   繁体   English

如何在ISML模板中从ProductBO对象循环“多个字符串”?

[英]How to loop a “Multiple String” from a ProductBO object in an ISML-Template?

How can I loop a Multiple String from a ProductBO object? 如何从ProductBO对象循环多个字符串? What is the best way to do this? 做这个的最好方式是什么?

As long as you know the name of the attribute you may use the following method on ProductBO from within an ISML: 只要您知道属性的名称,就可以在ISML中对ProductBO使用以下方法:

public AttributeValue getAttributeValue(String aName);

The storefront app comes with a convenient albeit not extremely flexible module that is able to display AV-s. 店面应用程序附带了一个方便的功能,尽管它不是非常灵活的模块,能够显示AV-s。 It works for multiple attributes too. 它也适用于多个属性。 The name of the module is ISCustomAttribute . 模块的名称为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 ): 自定义ProductBO属性打印在店面的“产品详细信息”页面上,如下图所示(@see DetailsTab.isml ):

在此处输入图片说明

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 . 我认为最合适的方法是使用BO扩展BusinessObjectAttributes You will be able retrieve a BusinessObjectAttribute by name from it and loop through its value. 您将能够从名称中检索BusinessObjectAttribute并遍历其值。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM