User Orders - CrystalCommerce Liquid Documentation for Designers

User Orders

The user orders page allows the user to manage their orders.

Additional Variables Available

buylist_enabled
Returns true if the store has enabled the buylist. False otherwise.

Used in Routes

  • /user/orders

File: user_orders.liquid

Default Liquid Template

<h1 class="pagetitle">{{ "orders.page_header" | trans }}</h1>
{% if orders.size > 0 %}
{{ orders | paginate: 'orders_page' }}
<table id="user_orders" width="95%" align="center" class="invisible-table">
  <tr>
    <th>Date</th>
    <th>Order&nbsp;#</th>
    <th>Total</th>
    <th>Status</th>
  </tr>

  {% for order in orders %}
  <tr>
    <td valign="top">{{ order.created_on }}</td>
    <td valign="top">{{ order.id }}</td>
    <td valign="top">{{ order.subtotal }}</td>
    <td valign="top">{{ order.status }}</td>
  </tr>
  {% if order.tracking_number %}
  <tr>
    <td></td>
    <td colspan="3"><strong>Tracking Number:</strong> {{ order.tracking_number }}</td>
  </tr>
  {% endif %}
  <tr>
    <td>
    <td colspan="3">
      <table class="list invisible-table" cellspacing="0" cellpadding="0" width="100%">
        <tr>
          <th width="60%">Name</td>
          <th>Ordered</th>
          <th>Shipped</td>
          <th>Price</td>
        </tr>
        {% for item in order.line_items %}
          <tr>
            <td>
              {% if item.product %}
              <a href="{{ item.product.url }}">{{ item.product.name }}</a><br/>
              {% else %}
              {{ item.name }}
              {% endif %}
              {% if item.variant %}
                <small>{{ item.variant.info }}</small>
              {% endif %}
            </td>
            <td align="center">{{ item.original_qty }}</td>
            <td align="center">{{ item.qty }}</td>
            <td>{{ item.price }}</td>
          </tr>
        {% endfor %}
      </table>
    </td>
  </tr>
  {% endfor %}
</table>
{{ orders | paginate }}
{% else %}
  <em>{{ "orders.no_orders_placed" | trans }}</em>
{% endif %}
{% if buylist_enabled %}
  <h1>{{ "buy_orders_header" | trans }}</h1>
{% if buy_orders.size > 0 %}
{{ buy_orders | paginate: 'buy_orders_page' }}
<table id="user_buy_orders" width="95%" align="center" class="invisible-table">
  <tr>
    <th>Date</th>
    <th>Buylist #</th>
    <th>Total</th>
    <th>Status</th>
  </tr>
    {% for order in buy_orders %}
    <tr>
      <td valign="top">{{ order.created_on }}</td>
      <td valign="top">{{ order.id }}</td>
      <td valign="top">{{ order.subtotal }}</td>
      <td valign="top">{{ order.status }}</td>
    </tr>
    <tr>
      <td>
      <td colspan="3">
        <table class="list invisible-table" cellspacing="0" cellpadding="0" width="100%">
          <tr>
            <th width="60%">Name</td>
            <th>Selling</th>
            <th>Rejected</td>
            <th>Price</td>
          </tr>
          {% for item in order.line_items %}
            <tr>
              <td>
                {{ item.product.name }}<br/>
                {% if item.variant %}
                  <small>{{ item.variant.info }}</small>
                {% endif %}
              </td>
              <td align="center">{{ item.qty }}</td>
              <td align="center">{{ item.buy_order_rejected_quantity }}</td>
              <td>{{ item.buy_price }}</td>
            </tr>
          {% endfor %}
        </table>
      </td>
    </tr>
    {% endfor %}
</table>
{{ buy_orders | paginate: 'buy_orders_page' }}
{% else %}
  <em>{{ "orders.no_buy_orders_placed" | trans }}</em>
{% endif %}
{% endif %}

Default Mobile Liquid Template

<header>
<h1 class="pagetitle"><a href="/user/home">Your Account</a></h1>
{% include 'header_icons' %}
</header>

<h1 class="pagetitle">Your Orders</h1>

{% if orders.size > 0 %}
<table id="user_orders" class="orders">
  <thead>
  <tr>
    <th class="created_on">Date</th>
    <th class="id">Order&nbsp;#</th>
    <th class="subtotal">Total</th>
    <th class="status">Status</th>
  </tr>
  </thead>
  <tbody>
  {% for order in orders %}
  <tr class="order_info">
    <td class="created_on">{{ order.created_on }}</td>
    <td class="id">{{ order.id }}</td>
    <td class="subtotal">{{ order.subtotal | money }}</td>
    <td class="status">{{ order.status }}</td>
  </tr>
  {% if order.tracking_number %}
  <tr>
    <td colspan="4"><strong>Tracking Number:</strong> {{ order.tracking_number }}</td>
  </tr>
  {% endif %}
  <tr>
    <td colspan="4">
      <table class="items">
        <thead>
        <tr>
          <th class="name">Name</td>
          <th class="qty">Ordered</th>
          <th class="qty_shipped">Shipped</td>
          <th class="price">Price</td>
        </tr>
        </thead>
        <tbody>
        {% for item in order.line_items %}
          <tr>
            <td class="name">
              {{ item.product.name }}<br/>
              {% if item.variant %}
                <span class="variant_info">{{ item.variant.short_info }}</span>
              {% endif %}
            </td>
            <td class="qty">{{ item.original_qty }}</td>
            <td class="qty_shipped">{{ item.qty }}</td>
            <td class="price">{{ item.price | money }}</td>
          </tr>
        {% endfor %}
        </tbody>
      </table>
    </td>
  </tr>
  {% endfor %}
  </tbody>
</table>
{% else %}
You have not made any orders. <a href="/">Browse the store</a>.
{% endif %}
{% if buylist_enabled %}
<h1>My Buylists</h1>
{% if buy_orders.size > 0 %}
<table id="user_buy_orders" class="orders">
  <thead>
    <tr>
      <th class="created_on">Date</th>
      <th class="id">Buylist #</th>
      <th class="subtotal">Total</th>
      <th class="status">Status</th>
    </tr>
  </thead>
  <tbody>
  {% for order in buy_orders %}
    <tr class="order_info">
      <td class="created_on">{{ order.created_on }}</td>
      <td class="id">{{ order.id }}</td>
      <td class="subtotal">{{ order.subtotal | money }}</td>
      <td class="status">{{ order.status }}</td>
    </tr>
    <tr>
      <td colspan="4">
        <table class="items">
          <thead>
            <tr>
              <th>Name</td>
              <th>Selling</th>
              <th>Rejected</td>
              <th>Price</td>
            </tr>
          </thead>
          <tbody>
          {% for item in order.line_items %}
            <tr>
              <td class="name">
                {{ item.product.name }}<br/>
                {% if item.variant %}
                  <span class="variant_info">{{ item.variant.short_info }}</span>
                {% endif %}
              </td>
              <td class="qty">{{ item.qty }}</td>
              <td class="rejected">{{ item.buy_order_rejected_quantity }}</td>
              <td class="price">{{ item.buy_price | money }}</td>
            </tr>
          {% endfor %}
          </tbody>
        </table>
      </td>
    </tr>
  {% endfor %}
  </tbody>
</table>
{% else %}
You have not yet sold us any thing. <a href="{{ site.start_selling_url }}">Sell to us now</a>.
{% endif %}
{% endif %}

Drops Supported