This file contains 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
<script> | |
jQuery(document).ready(function($){ | |
var images = []; | |
{% for image in product.images %} | |
images.push({url: "{{ image | product_img_url: 'medium' }}", alt: "{{ image.alt }}"}); | |
{% endfor %} | |
var thumbnails = $(".thumbs"); |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
<ul> | |
{% comment %}A linklist should be created called "Collections" containing each of the "top" level collections{% endcomment %} | |
{% for link in linklists.collections.links %} | |
{% assign col = link.object %} | |
<li class="{% if col.handle == collection.handle %}active{% endif %}"> | |
<a href="{{ link.url }}"><span>{{ link.title }}</span></a> | |
{% if col.all_tags.size > 0 %} | |
<ul> | |
{% assign tag_index = 0 %} | |
{% assign current_tag = "" %} |
This file contains 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
{% assign articles = blogs.news.articles | sort: 'title' %} | |
{% for article in articles %} | |
{{ article.title }}<br> | |
{% endfor %} |
This file contains 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
{% raw %} | |
<script id="recently-viewed-product-template" type="text/x-jquery-tmpl"> | |
{{each(prop, val) images}} | |
{{if val.toLowerCase().indexOf(".imagename") >= 0 }} | |
<div id="product-${handle}" class="product"> | |
<div class="image"> | |
<a href="${url}" class="cy"> | |
<img src="${Shopify.Products.resizeImage(val, "medium")}" /> | |
</a> | |
</div> |
This file contains 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
$('.single-option-selector').each(function() { | |
var numOptions = $(this).children().length; | |
if(numOptions == 1) { | |
$(this).hide(); | |
$(this).before( "<p>" + $(this).val() + "</p>"); | |
} | |
}); |
This file contains 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
{% for option in product.options %} | |
{% if option contains "Color" %} | |
{% assign optionName = "option" | append: forloop.index %} | |
{% assign colors = product.variants | map: optionName %} | |
{% assign colorsFiltered = '' %} | |
{% for colorOption in colors %} | |
{% unless colorsFiltered contains colorOption %} | |
{% assign colorsFiltered = colorsFiltered | append: ', ' | append: colorOption %} | |
{% endunless %} | |
{% endfor %} |
This file contains 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
{% assign total = product.variants | map: 'available' | join: ", " | remove: 'false, ' %} | |
{% assign available = total | split: ',' %} | |
{{ available.size }} of {{ product.variants.size }} left |
This file contains 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
{% if product.options.size == 1 %} | |
{% for variant in product.variants %} | |
{% unless variant.available %} | |
jQuery('.single-option-selector option:contains(' + {{ variant.title | json }} +')').remove(); | |
{% endunless %} | |
{% endfor %} | |
jQuery('.single-option-selector').trigger('change'); | |
{% endif %} |
This file contains 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
{% assign collection_tags = collection | map: 'tags' %} | |
{% for tag in collection_tags %} | |
<a href="/collections/{% if collection.handle != blank %}{{ collection.handle }}{% else %}all{% endif %}/{{ tag | handleize }}" title="{{ tag | escape }}">{{ tag }}</a> | |
{% endfor %} |
NewerOlder