Developer forum

Forum » CMS - Standard features » Accessing Product Category Fields in a Products loop

Accessing Product Category Fields in a Products loop

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

 

I have a products list page that uses a Products loop to output my products. The product group I am rendering has a product category associated with it that in turn contains a field called IsConfigurable. When I use DwTemplateTags, I see this field show up with a value. However, without DwTemplateTags it doesn't work. In other words, this:

<!--@If Defined(IsConfigurable)-->
Starting from:
<!--@EndIf-->

outputs nothing, no matter the value for IsConfigurable. However, this:

<!--@DwTemplateTags-->
<!--@If Defined(IsConfigurable)-->
Starting from:
<!--@EndIf-->

works fine and outputs the text in the If statement.

 

Any idea what's going on? How can I access a product category field inside a product loop? This appears to work fine on a products details page.

 

Cheers,


Imar


Replies

 
Merethe Nielsen
Reply

Hi Imar

 

You need to write the full tag (Ecom:Product.CategoryField.TestCat.IsConfigurable.Value) instead of IsConfigurable in the statement, like this : 

 

 

I have reproduced your problem, but the problem disappears when you insert the full tag:

http://screencast.com/t/Xg0jctipsE

 

Kind regards,

Merethe

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Merethe,

 

>> I have reproduced your problem, but the problem disappears when you insert the full tag:

 

Yes, I know. However, I wanted to use the "shortcut" as I have multiple Product Categories that all feature an IsConfigurable field. Using the top level tag would allow me to use it, regardless of the name of the Product Category.

 

Is it a bug that the tag shows up as a top-level tag when you use DwTemplateTags or is it a bug that it disappears?

Imar

 

You must be logged in to post in the forum