Difference between revisions of "Shopify Liquid"

From the Directed Edge Developer Base
Jump to: navigation, search
(Created page with "__TOC__ == Liquid Variables supported by Directed Edge == Following Liquid Variables are supported in custom templates: * groups - An array of recommendation types with following...")
 
Line 1: Line 1:
 
__TOC__
 
__TOC__
 
== Liquid Variables supported by Directed Edge ==
 
== Liquid Variables supported by Directed Edge ==
 +
=== groups ===
 +
The liquid variable groups contain all recommendation types that are available for the requested page.
 +
<source lang="xml">
 +
{% for group in groups %}
 +
  {{ group.label }}
 +
  <ul></ul>
 +
{% endfor %}
 +
</source>
 +
Each group has following properties:
 +
{| class="wikitable"
 +
|-
 +
| label || A formatted label of the group. E.g. 'Recommended Items', 'Recently Viewed', etc. Those labels can be customized in the [http://shopify.directededge.com/settings#styling Directed Edge for Shopify Appearance Settings] page.
 +
|-
 +
| handle || A machine friendly identifier for the group (e.g. bundle, recommended_product, etc.).
 +
|-
 +
| products || A list of products that are recommended in this category.
 +
<source lang="xml">
 +
{% for group in groups %}
 +
  <ul>
 +
  {% for product in group.products %}
 +
    <li>
 +
    <b>{{ product.title }}</b><br />
 +
    {{ product.price | money }}
 +
  {% endfor %}
 +
  </ul>
 +
{% endfor %}
 +
</source>
 +
|-
 +
| bundle || A boolean field that indicates if this group is a bundle
 +
|}
 
Following Liquid Variables are supported in custom templates:
 
Following Liquid Variables are supported in custom templates:
 
* groups - An array of recommendation types with following variables
 
* groups - An array of recommendation types with following variables
Line 11: Line 41:
 
** price - The sum of a bundles price
 
** price - The sum of a bundles price
 
** buy_link - A link that will add a bundle's products into the cart
 
** buy_link - A link that will add a bundle's products into the cart
 +
 +
== Examples ==
 +
Simple example

Revision as of 00:01, 10 October 2013

Liquid Variables supported by Directed Edge

groups

The liquid variable groups contain all recommendation types that are available for the requested page.

{% for group in groups %}
  {{ group.label }}
  <ul></ul>
{% endfor %}

Each group has following properties:

label A formatted label of the group. E.g. 'Recommended Items', 'Recently Viewed', etc. Those labels can be customized in the Directed Edge for Shopify Appearance Settings page.
handle A machine friendly identifier for the group (e.g. bundle, recommended_product, etc.).
products A list of products that are recommended in this category.
{% for group in groups %}
  <ul>
  {% for product in group.products %}
    <li>
    <b>{{ product.title }}</b><br />
    {{ product.price | money }}
  {% endfor %}
  </ul>
{% endfor %}
bundle A boolean field that indicates if this group is a bundle

Following Liquid Variables are supported in custom templates:

  • groups - An array of recommendation types with following variables
    • handle - A machine friendly identifier for the group (e.g. bundle, recommended_product, etc.)
    • label - A rendered label text (according to your settings)
    • bundle - A boolean field that indicates if this group is a bundle
    • products - An array of Products
  • bundle
    • text - Bundle's buy message (e.g. 'Buy both for 20$')
    • price - The sum of a bundles price
    • buy_link - A link that will add a bundle's products into the cart

Examples

Simple example