how insert variable into expression?

by Kai - Member - 12:41PM, May 16, 2008

I have defined a variable and want to insert it into an expression. I don’t know how to do this.

// defining the variable “recommendation”

{% case product.type %}
  {% when 'Poster' %}
   {% assign recommendation = 'notposter' %}
  {% when 'Toys' %}
   {% assign recommendation = 'nottoys' %}
  {% else %}
{% endcase %}

// trying to insert the variable “recommendation” into an expression

{% tablerow product in collections.recommendation.products cols:3  %}

Thanks for help! – Kai

Christina

Miss Manners

09:07PM, May 16, 2008

{% tablerow product in collections[recommendation].products cols:3  %}

i usually do it like this and it works:

{% tablerow product in collections.[recommendation].products cols:3  %}

but apparently the first expression is the proper syntax.

---

on ice

Kai

Member

09:42PM, May 16, 2008

Thanks a so much Christina! It works perfectly!!! :)

You must login to post a comment!

Don't have an account yet? Sign up for one.