d
Topic
Jeff Member
Posts:
58
February 09, 2007

Variant's table This post is outdated

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....
i
Replies
Posts:
2056
February 09, 2007

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
Jeff Member
Posts:
58
February 09, 2007

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??

danW Shopify Advisor
Posts:
1037
Last edited February 09, 2007

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

Its towards the bottom.

Dan - http://www.xtremechargers.com
Jeff Member
Posts:
58
February 09, 2007

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??

danW Shopify Advisor
Posts:
1037
Last edited February 09, 2007

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
danW Shopify Advisor
Posts:
1037
February 09, 2007

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
Jeff Member
Posts:
58
February 09, 2007

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.

Posts:
2056
February 09, 2007

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

Tobias Lütke - Shopify CEO // http://twitter.com/tobi
danW Shopify Advisor
Posts:
1037
Last edited February 09, 2007

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

Dan - http://www.xtremechargers.com
Jeff Member
Posts:
58
February 09, 2007

Any chance we can use variables for the limit and offset options like this,

{% for variant in product.variants limit:i offset:j %}

This way I can control which variants I’m working with?? Again goes back to being able to set and use variables.
And I’d really like strings as Dan comments above, so I can manage my list…

Jeff Member
Posts:
58
February 09, 2007

I have in my store around 100 products. There are about 10 of them that could use the type of example I’ve got on my test store. I can make that code work, and it does today. However, without any programatic control, I have to rewrite the code for each of the products, since they have different numbers of column and variants and titles. My original plan was to set some variables in the product.liquid page, based on the product name. Then I would only need to write the table code once, and it would work for any page that needs this specialized setup. That is what I am trying to accomplish easily, instead of copying the code many times over in the product.liquid page.

Posts:
734
February 09, 2007

I’ve been thinking about a different kind of product/product category setup, because I’ve been bothered by the need to have the same product in different colours appear as different products. This could be for various reasons: in my case it’s because I want to display and tag the different colour variations, without having one be subordinate to the other; but for other people it’s because they want to sell the same yellow or green or black T-shirts of the same design (for example) in different sizes. So there’s definitely a problem with the product hierarchy.

A possible solution – but I haven’t tried this yet – is the following: Let’s say you have various pairs of shoes of identical style, brand, etc in different colours and different sizes. Let’s take FunkyShoe and FancyShoe, let’s say for women.

You would then list all your colour variants (say red FunkyShoe, blue FunkyShoe, red FancyShoe, and so on) as separate products in the “Women’s Shoes” Collection. For each individual product, you then create size variants. Also tag each product by colour.

But then you would also create Standard Collections containing only the same model or type, i.e, Collection FunkyShoes, which would contain all and only Funky Shoes, in red, blue and purple. And so on. Do that for each product which has different colour variations. So you’d have different types of sorting ability – by collection, colour “sub-collection”, variants (=sizes), and tags, for your 3-(or 4?)dimensional array of products.

Then, with a sufficient number of conditionals, you could build up a mixed tag-and-collection based navigation, and you might be able to do what you want in your table as well.

I’m thinking that this could also solve the “related products” problem, in that you could show other products from the same “sub-collection” (or product group) on each product page. I’ll be trying that soon.

Hope I wasn’t too convoluted tonight. Good luck!

operation absurdist feature requests: terminated (http://en.wikipedia.org/wiki/Absurdism)
Posts:
29
February 14, 2007

Christina, thanks for referring me to this page again. I think I more or less get it now. Let me think about how to apply this to our page.

Actually, I am afraid to make changes of this magnitude without first spending some time setting up the DB in the vision tool, and play with that some more.

http://www.modacolombia.ca Moda Colombia Lingerie in Canada