Skip to content

Instantly share code, notes, and snippets.

@larilehtonen
Last active May 23, 2016 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larilehtonen/0b0b2d9720b87d0bf818 to your computer and use it in GitHub Desktop.
Save larilehtonen/0b0b2d9720b87d0bf818 to your computer and use it in GitHub Desktop.
{# snippet 'snippets/nosto.rain' #}
{% set account = 'ACCOUNT-ID-HERE' %}
<script type="text/javascript" src="//:my.nosto.com/include/{{ account }}" async></script>
{% if page.cart %}
<div class="nosto_external_visit_ref" style="display:none">{{ page.cart.quote_id }}</div>
{% endif %}
{% if order %}
<div class="nosto_external_visit_ref" style="display:none">{{ order.information.quote_id }}</div>
{% endif %}
{% if page.search %}
<div class="nosto_search_term" style="display:none">{{ page.search }}</div>
{% endif %}
{% if collection.internal.url %}
<div class="nosto_category" style="display:none">{{ collection.internal.url }}</div>
{% endif %}
{% if product %}
<div class="nosto_product" style="display:none">
<span class="url">{{ product.url | url }}</span>
<span class="product_id">{{ product.id }}</span>
<span class="name">{{ product.title }}</span>
<span class="thumb_url">{{ product.image | url_image('200x200x2') }}</span>
<span class="image_url">{{ product.image | url_image }}</span>
<span class="price">{{ product.price.price_incl }}</span>
<span class="price_currency_code">{{ shop.currency | upper }}</span>
{% if product.stock.available %}
<span class="availability">InStock</span>
{% else %}
<span class="availability">OutOfStock</span>
{% endif %}
{% for category in product.categories %}
<span class="category">{{ category.url }}</span>
{% endfor %}
<span class="description">{{ product.description }}</span>
{% if product.price.price_old > 0 %}
<span class="list_price">{{ product.price.price_old_incl }}</span>
{% endif %}
<span class="brand">{{ product.brand.title }}</span>
{% for tag in product.tags %}
<span class="tag1">{{ tag.title }}</span>
{% endfor %}
</div>
{% endif %}
<div class="nosto_cart" style="display:none">
{% if page.cart %}
{% for product in page.cart.products %}
<div class="line_item">
<span class="product_id">{{ product.id }}</span>
<span class="quantity">{{ product.quantity }}</span>
<span class="name">{{ product.title }}</span>
<span class="unit_price">{{ product.price.price_incl }}</span>
<span class="price_currency_code">{{ shop.currency | upper }}</span>
</div>
{% endfor %}
{% endif %}
</div>
{% if page.account.email %}
<div class="nosto_customer" style="display:none">
<span class="email">{{ page.account.email }}</span>
<span class="first_name">{{ page.account.firstname }}</span>
<span class="last_name">{{ page.account.lastname }}</span>
</div>
{% endif %}
{% if order %}
<div class="nosto_purchase_order" style="display:none">
<span class="order_number">{{ order.information.number }}</span>
<div class="buyer">
<span class="email">{{ order.customer.email }}</span>
<span class="first_name">{{ order.customer.firstname }}</span>
<span class="last_name">{{ order.customer.lastname }}</span>
</div>
<div class="purchased_items">
{% for item in order.products %}
<div class="line_item">
<span class="product_id">{{ item.product_id }}</span>
<span class="quantity">{{ item.quantity }}</span>
<span class="name">{{ item.title }}</span>
<span class="unit_price">{{ item.base_price_incl }}</span>
<span class="price_currency_code">{{ shop.currency | upper }}</span>
</div>
{% endfor %}
</div>
</div>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment