如何从ProductBO对象循环多个字符串?做这件事最好的方法是什么?
发布于 2017-02-14 20:31:54
只要知道属性的名称,就可以在ProductBO中使用以下方法:
public AttributeValue getAttributeValue(String aName);
storefront应用程序附带了一个方便的、但不是非常灵活的模块,可以显示AV-s。它也适用于多个属性。该模块的名称为ISCustomAttribute。
示例用法:
<isCustomAttribute
attributelabel="#AttributeDescriptor:DisplayName#"
attributevalue="#ProductBO:AttributeValue(AttributeDescriptor:ID)#"
attributeseparator=", ">最好的方法是使用这个模块。你可能会看到它的实际效果。如下图所示(@参见DetailsTab.isml),自定义ProductBO属性将打印在storefront的产品详细信息页面上:

如果这不适合,你将不得不检索属性作为可迭代的东西。我认为最合适的方式是使用BO扩展BusinessObjectAttributes。您将能够按名称检索BusinessObjectAttribute并遍历它的值。
<isloop iterator="BusinessObjectAttribute:Value" alias="AValue" counter="counter">
<!--- Do something gorgeous here --->
</isloop>https://stackoverflow.com/questions/42225626
复制相似问题