Preorder attributes - CrystalCommerce Liquid Documentation for Designers

Preorder attributes

Added ProductDrop#preorder? and ProductDrop#available_on to expose Preorder information.

Usage

In _product.liquid:

@@ -1,1 +1,1 @@
-<tr id="{{ product.row_id }}" class="{% cycle 'even', 'odd' %}">
+<tr id="{{ product.row_id }}" class="{% cycle 'even', 'odd' %}{% if product.preorder?"}} %} preorder{% endif %}">

@@ -16,16 +16,21 @@
-<a href="{{ product.url }}">{{ product.name }}</a><br />
+<a href="{{ product.url }}">{{ product.name }}</a>
+{% if product.preorder? %}
+  <span class="preorder_date">Preorder now! Available on
+    {{ product.available_on }}</span>
+{% endif %}
+<br />

@@ -37,37 +42,48 @@
-<td align="right" width="30%">{{ 'Buy" | link_to_add_cart_with_qty: product, variant' }} }}</td>
+<td align="right" width="30%">
+  {% if product.preorder? %}
+    {{ 'Preorder Now" | link_to_add_cart_with_qty: product, variant' }} }}
+  {% else %}
+    {{ 'Buy" | link_to_add_cart_with_qty: product, variant' }} }}
+  {% endif %}
+</td>

In product.liquid:

@@ +17,20 @@
+{% if product.preorder? %}
+<h2>Preorder now!</h2>
+<p>Available on {{ product.available_on }}</p>
+{% endif %}

@@ -56,56 +60,64 @@
-{{ '<span class='}}'add_to_cart button'{{ '>Add to Cart</span>" | link_to_add_cart: product, variant ' }}}}
+{% if product.preorder? %}
+  {{ '<span class='}}'add_to_cart button'{{ '>Preorder Now!</span>" | link_to_add_cart: product, variant ' }}}}
+{% else %}
+  {{ '<span class='}}'add_to_cart button'{{ '>Add to Cart</span>" | link_to_add_cart: product, variant ' }}}}
+{% endif %}