Skip to content

Instantly share code, notes, and snippets.

@rdallaire
Created October 10, 2014 23:18
Show Gist options
  • Select an option

  • Save rdallaire/54fb8f87b37a61807787 to your computer and use it in GitHub Desktop.

Select an option

Save rdallaire/54fb8f87b37a61807787 to your computer and use it in GitHub Desktop.
product
{% for cat in product.category.self_and_ancestors %}
{% if forloop.first %}
{% assign parentID = cat.id %}
{% assign parentName = cat.name %}
{% assign parentUrl = cat.url %}
{% endif %}
{% assign productCategory = cat.name %}
{% endfor %}
<li class="product" itemscope itemtype="http://schema.org/Product" data-catalog-id="{{ product.catalog_id }}">
<div class="inner">
<div class="image-meta">
<div class="image">
<a href="{{ product.buylist_aware_url }}" itemprop="url" title="{{ product.name }}">
{% if product.main_photo != false %}
<img src="{{ product.medium_photo }}" alt="{{ product.name }}" itemprop="image">
{% else %}
<img src="{{ 'img/ui/no-image-available.png' | asset_url }}" alt="{{ product.name }}" itemprop="image">
{% endif %}
</a>
</div>
<div class="meta">
<a href="{{ product.buylist_aware_url }}" itemprop="url">
<h4 class="name" itemprop="name">{{ product.name }}</h4>
</a>
{% if template_filename == "search" or template_filename == "advanced_search" or template_filename == "product" %}
{% comment %}<span class="category">{{ product.category.name }}</span>{% endcomment %}
<span class="category">{{ parentName }}</span>
{% endif %}
<span class="offers" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
{% if product.variants.size > 0 %}
{% unless product.buylist_mode? %}
{% if product.msrp > product.sell_price %}
<span class="price msrp">{{ product.msrp }}</span>
{% endif %}
{% endunless %}
<span class="price" itemprop="price">
{% if product.buylist_mode?%}
{{ product.buy_price | money }}
{% else %}
{{ product.sell_price | money }}
{% endif %}
</span>
<span class="qty">
{% if site.buylist_mode?%}
Buylist Limit {{ product.qty }}
{% else %}
{{ product.qty }} {{ "product.quantity_in_stock_label" | trans }}
{% endif %}
</span>
{% else %}
{% if product.buylist_mode?%}
<span class="price" itemprop="price">{{ product.buy_price }}</span>
{% else %}
<span class="price no-stock hide" itemprop="price">{{ product.sell_price }}</span>
{% endif %}
<span class="stock-indicator no-stock" itemprop="availability">{{ "product.out_of_stock" | trans }}</span>
{% endif %}
</span>
{% unless product.buylist_mode? %}
{% if product.preorder? %}
<span class="preorder">Preorder Today! Available on {{ product.available_on }}</span>
{% endif %}
{% endunless %}
{% if template_filename == 'user_wishlist' %}
<span class="button utility view">{{ "Remove" | link_to_delete_wishlist_product: product }}</span>
{% else %}
<a href="{{ product.buylist_aware_url }}" class="button utility view">View Product</a>
{% endif %}
</div>
</div>
<div class="variants">
{% if product.variants.size > 0 %}
{% for variant in product.variants %}
<div class="variant-row row">
<span class="variant-main-info small-12 medium-3 large-6 column">
{% if site.buylist_mode? %}
<span class="variant-short-info">{{ variant.short_info }}, <em>Buylist Limit {{ variant.qty }}</em></span>
{% else %}
<span class="variant-short-info">{{ variant.short_info }}, <em>{{ variant.qty }} {{ "product.quantity_in_stock_label" | trans }}</em></span>
{% endif %}
</span>
<span class="variant-buttons small-12 medium-9 large-6 column">
{% include 'theme/snippets/product_add_cart' %}
</span>
</div>
{% endfor %}
{% else %}
<div class="variant-row row no-stock">
<span class="variant-main-info small-12 medium-3 large-9 column">
<em>Add to wishlist to be notified when the item is in stock.</em>
<span class="price no-stock hide" itemprop="price">
{% if product.buylist_mode?%}
{{ product.buy_price | money }}
{% else %}
{{ product.sell_price | money }}
{% endif %}
</span>
</span>
<span class="variant-buttons small-12 medium-9 large-3 column">
{% include 'theme/snippets/product_add_cart' %}
</span>
</div>
{% endif %}
</div>
</div>
</li>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment