Created
April 8, 2010 17:52
-
-
Save carolineschnapp/360328 to your computer and use it in GitHub Desktop.
Hiding 'Default' drop-down in Reconfigured
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1> | |
{{ product.title }} | |
{% for variant in product.variants %} | |
{% if variant.available %} | |
{% else %} | |
<span class="soldout"><em>{{ variant.title }}</em> is currently Sold Out! :(</span> | |
{% endif %} | |
{% endfor %} | |
</h1> | |
<!--product-block--> | |
<div class="product-block"> | |
<div class="visual-column"> | |
{% for image in product.images %} | |
{% if forloop.first %} | |
<a href="{{ image | product_img_url: 'large' }}" class="productimage" rel="lightbox-{{ product.handle }}" title="Pictures of {{product.title | escape }}"> | |
<img src="{{ image | product_img_url: 'large'}}" alt="{{product.title | escape }}" /> | |
</a> | |
{% else %} | |
{% if forloop.index == 2 %} | |
<ul> | |
{% endif %} | |
<li> | |
<a href="{{ image | product_img_url: 'large' }}" class="productimage-small" rel="lightbox-{{ product.handle }}" title="Pictures of {{product.title | escape }}"> | |
<img src="{{ image | product_img_url: 'small'}}" alt="{{product.title | escape }}" /> | |
</a> | |
</li> | |
{% if forloop.last %} | |
</ul> | |
{% endif %} | |
{% endif %} | |
{% endfor %} | |
</div> | |
<div class="user-column"> | |
{{ product.description }} | |
<form action="/cart/add" method="post" class="cartableProduct"> | |
<div id="product-variants"> | |
{% if product.variants.size == 1 %} | |
<input type="hidden" name="id" value="{{ product.variants.first.id }}" /> | |
{% else %} | |
<fieldset> | |
<select id="product-select" name='id'> | |
{% for variant in product.variants %} | |
<option value="{{ variant.id }}">{{ variant.title }} - {{ variant.price | money }}</option> | |
{% endfor %} | |
</select> | |
</fieldset> | |
{% endif %} | |
<div id="price-field">{{ product.price | money_with_currency }}</div> | |
</div> | |
<input type="image" src="{{ 'add_to_shopping_bag.gif' | asset_url }}" name="add" value="Purchase" id="purchase" /> | |
</form> | |
</div> | |
</div> | |
{% unless product.variants.size == 1 %} | |
<script type="text/javascript"> | |
// <![CDATA[ | |
var selectCallback = function(variant, selector) { | |
if (variant && variant.available == true) { | |
// selected a valid variant | |
jQuery('#purchase').removeClass('disabled').removeAttr('disabled'); // remove unavailable class from add-to-cart button, and re-enable button | |
jQuery('#price-field').html(Shopify.formatMoney(variant.price, "{{shop.money_with_currency_format}}")); // update price field | |
} else { | |
// variant doesn't exist | |
jQuery('#purchase').addClass('disabled').attr('disabled', 'disabled'); // set add-to-cart button to unavailable class and disable button | |
var message = variant ? "Sold Out" : "Unavailable"; | |
jQuery('#price-field').html(message); // update price-field message | |
} | |
}; | |
// initialize multi selector for product | |
jQuery(function() { | |
new Shopify.OptionSelectors("product-select", { product: {{ product | json }}, onVariantSelected: selectCallback }); | |
}); | |
// ]]> | |
</script> | |
{% endunless %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment