Shopify customers / account.liquid创建循环排序

时间:2015-07-16 17:22:24

标签: shopify liquid

我正在尝试按shipping_address.name

对customers / account.liquid中的订单进行排序
{% assign orders = customer.orders | sort: 'shipping_address.name' %}
{% for order in orders %}  
  <tr class="{% cycle 'odd', 'even' %} {% if order.cancelled %}cancelled_order{% endif %}">
    <td>{{ order.name | link_to: order.customer_url }}</td>
    <td><span class="ship_name">{{ order.shipping_address.name }}</span></td>
    <td><span class="note">{{ order.created_at | date: format: 'month_date_year' }}</span></td>
    <td><span class="status_{{ order.financial_status }}">{{ order.financial_status }}</span></td>
    <td><span class="status_{{ order.fulfillment_status }}">{{ order.fulfillment_status }}</span></td>
    <td><span class="total money">{{ order.total_price | money }}</span></td>
  </tr>
{% endfor %}

see screen shot

1 个答案:

答案 0 :(得分:0)

你忘了使用已排序的数组!通过稍微重命名变量,我更容易理解。

{{1}}

希望你睡得充足!