How do I use nVelocity for arrays or collections?
I tried using this in Scriptlets\Custom\Content\Show Product 1.htm:
#if($Product.CustomFields[0].FieldName == "Engraving")
but got an error. It complains about the [ ], so I changed then to ( ) :
#if($Product.CustomFields(0).FieldName == "Engraving")
the page displayed without error, but it didn't work.
Similarily, this works:
#if($Product.ProductProductTemplates.Count > 0)
but this didn't:
#if($Product.ProductProductTemplates[0].ProductTemplateId == 5)
How do I use nVelocity for arrays or collections
Re: How do I use nVelocity for arrays or collections
You need to do it like
Code: Select all
#if($Product.ProductProductTemplates.get_Item(0).ProductTemplateId == 5)
..................
..................
..................
#end