views:

72

answers:

1

Hi,

With Shopify I am trying to alter my product template to display a dropdown select list instead of radio buttons for my product variants. I managed to do this but when you try and add a product to the cart from the list it says, "No variant ID was passed."

Here is the code for their radio buttons:

<ul id="product-variants">
            {% for variant in product.variants %}
            <li>
              {% if variant.available %}
                <input type="radio" name="id" value="{{variant.id}}" id="radio_{{variant.id}}" style="vertical-align: middle;" {%if forloop.first%} checked="checked" {%endif%} />
                <label for="radio_{{variant.id}}"><span class="sku">{{ variant.sku }}</span>  {%if variant.title != 'Default' %}{{ variant.title }} for {%endif%}  <span class="price">{{ variant.price | money_with_currency }}</span></label>
              {% else %}
                <del style="margin-left: 26px">{{ variant.title }}</del>&nbsp;<span>Sold Out!</span>
              {% endif %}
            </li>
            {% endfor %}
          </ul>

Here is the code for my dropdown select at this point:

<select id="product-variants">
            {% for variant in product.variants %}
            <li>
              {% if variant.available %}
                <option value="{{variant.id}}" selected="selected"><span class="sku">{{ variant.sku }}</span>  {%if variant.title != 'Default' %}{{ variant.title }} for {%endif%}  <span class="price">{{ variant.price | money_with_currency }}</span></option>
              {% else %}
                <del style="margin-left: 26px">{{ variant.title }}</del>&nbsp;<span>Sold Out!</span>
              {% endif %}
            </li>
            {% endfor %}
          </select>

Thanks,

Wade

A: 

http://wiki.shopify.com/Product.liquid

This wiki had the answer.

Wade D Ouellet