Developer forum

Forum » Feature requests » Item list - pass in values

Item list - pass in values

Nuno Aguiar
Reply

Hi,

 

In attach we can see a typical Render Item List tag. We can filter the items but all of the processing happens on another template (another scope), but sometimes we need data from the "parent" scope to be used in that list.

 

Would be nice if we could either send a few variables (strings, products, ....) much like parameters in a method.

 

Best Regards,

Nuno Aguiar

RenderItemList.PNG

Replies

 
Nicolai Høeg Pedersen
Reply

Hi Nuno

I do not understand what you want... Can you ellaborate?

BR Nicolai

 
Nuno Aguiar
Reply

Hi Nicolai,

 

The attachment is an example from a product detail page, where we are rendering a list of items (FAQ's related to the product).

 

The Item has a fields have multiple fields

  • Keywords
  • Products associated with this FAQ
  • Theme
  • Format
  • ...

 

We are already getting a list of the relevant FAQ, but we need to match the item's fields against a product's field to do some extra HTML: Ex:

- FAQ 1 - related to keywords and theme

- FAQ 2 - related to formart and theme 

 

Because the Item list is being rendered in a seperate template I cannot do stuff like this:

if (item.GetString("Format") == product.GetString("X)) {

  @* do some extra stuff *@

}

 

Does this make sense? Do you know how we could do that currently?
 

Best Regards,

Nuno Aguiar

 
Nicolai Høeg Pedersen
Reply

Hi Nuno

In your product template try this:

@ViewBag.Product = product;

And in your Razor template that renders the item list

@{
Dynamicweb.eCommerce.Products.Product product = ViewBag.Product;
}

Then you now have a variable in your item list template with the product loop item instance.

Voila!