How do I use nVelocity for arrays or collections

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
Mike718NY
Commodore (COMO)
Commodore (COMO)
Posts: 485
Joined: Wed Jun 18, 2008 5:24 pm

How do I use nVelocity for arrays or collections

Post by Mike718NY » Wed Jan 13, 2010 5:06 am

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)

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: How do I use nVelocity for arrays or collections

Post by mazhar » Wed Jan 13, 2010 5:41 am

You need to do it like

Code: Select all

#if($Product.ProductProductTemplates.get_Item(0).ProductTemplateId == 5)
..................
..................
..................
#end

Post Reply