Variant's table

Highlighted
New Member
58 0 0
We are selling some items that are basically insoles for shoes, so there are mens/ladies and different sizes.... I have all the variants loaded within the product.... I"m wondering if it's possible to present that information as a table with radio buttons under headings, so the buyer, can just select the radio button for the size/sex?? With headings across the top, and either work the price from the variants into the headings or display it when the radio box is selected?? Then it would just pass the variant id to the cart. Any thoughts or suggestions on how this might be accomplished?? Very very new to this stuff..... I figured I could tag, or hard code or create a special collection to look at, so that I could apply this special buying table to just these specific product sets... Thoughts anyone....
0 Likes
Shopify Staff
Shopify Staff
2045 0 39

I would just flatten the data into a dropdown selection list.

  • Men – Small
  • Men – Medium
  • Men – Large
  • Female – Small
  • Female – Medium
  • Female – Large
Tobias Lütke - Shopify CEO // http://twitter.com/tobi
0 Likes
New Member
58 0 0

Tobi, thanks for the idea.. I have a solution working now. I’m now trying to make it more generic but I’m now stuck on how to setup an array. I want to use this.


    {% for tabtitle in array %}
        <th>{{ tabtitle }}</th>
       {% endfor %}

My problem is how do I seed the variable array with values??
Anyone??

0 Likes
Excursionist
1037 0 8

Check out the Shopify Documentation. http://help.shopify.com/design/show/UsingLiquid

Its towards the bottom.

Dan - http://www.xtremechargers.com
0 Likes
New Member
58 0 0

Dan, I tried that, and I guess I’m missing something, because having

array = [1,2]
 {% for tabtitle in array %}
in my product.liquid file results in it displaying array=[1,2] on screen and the for loop never runs corectly, so it’s not setting the array to values… Any thoughts??

0 Likes
Excursionist
1037 0 8

I am not sure if you can create your own array, but if you could you would have to wrap it with this:



 {% assign: array = [1,2] %}
   {% for item in array %}
     {{ item }}
   {% endfor %}

edit

Or something like this:



  {% assign: array = [1,2] %}
   {% for item in array do |item| %}
     {{ item }}
   {% endfor %}
Dan - http://www.xtremechargers.com
0 Likes
Excursionist
1037 0 8

Out of curiosity, I tried both. Neither work. I don’t think it is possible to create your own array. Maybe one of the Shopify Guys will chime in.

Dan - http://www.xtremechargers.com
0 Likes
New Member
58 0 0

Well, as you suspected that does not seem to work….
So, now I”m open to suggestions…
I have built the ability to create a table of selections for variations to submit to the cart. This works well, for size/colour combinations type situations.
The problem is that each different product can have a different number of variations, or types. So I was attempting to set variables to pass to the routine, so that it would not have to be specially coded for each product that needed it within the product.liquid page… You can see an example at gams.myshopify.com looking at the Test variation.

0 Likes
Shopify Staff
Shopify Staff
2045 0 39

{% for i in (1..2) %} would work

Tobias Lütke - Shopify CEO // http://twitter.com/tobi
0 Likes
Excursionist
1037 0 8

You can’t use strings with that though right? It appears just numbers.

Dan - http://www.xtremechargers.com
0 Likes