Is there any way to create a list of previously ordered items, with images as well, in Shopify? Basically what I'm after is a list on the front page of 3 items that were previously purchased by the user.
Shopify中有没有办法在图像中创建以前订购的商品列表?基本上我所追求的是在用户先前购买的3个项目的首页上的列表。
2 个解决方案
#1
0
The user will need to be logged in for the following to work. If the user is logged in, then you can use the following code to display their orders. This will display only 3 orders.
用户需要登录才能使用以下内容。如果用户已登录,则可以使用以下代码显示其订单。这将只显示3个订单。
{% if customer.orders.size != 0 %}
<table>
<thead>
<tr>
<th class="order_number">Order</th>
<th class="date">Date</th>
<th class="payment_status">Payment Status</th>
<th class="fulfillment_status">Fulfillment Status</th>
<th class="total">Total</th>
</tr>
</thead>
<tbody>
{% for order in customer.orders limit:3 %}
<tr class="{% cycle 'odd', 'even' %} {% if order.cancelled %}cancelled_order{% endif %}">
<td>{{ order.name | link_to: order.customer_url }}</td>
<td><span class="note">{{ order.created_at | date: "%b %d, %Y" }}</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 %}
</tbody>
</table>
{% else %}
<p>You haven't placed any orders yet.</p>
{% endif %}
#2
0
When a customer is logged in, there will be a customer
liquid variable available with lots of data about the user. If you look through the docs, there is a member variable called order
which will give you an array of all of the users orders. There is also a variable called recent_order
which will give you the most recent order by the user.
当客户登录时,将有一个客户流量变量,其中包含大量有关用户的数据。如果查看文档,就会有一个名为order的成员变量,它将为您提供所有用户订单的数组。还有一个名为recent_order的变量,它将为您提供用户最近的订单。
If you are familiar with the Liquid template language used by Shopify, this should be enough to get you started. Generally, the Shopify wiki is very helpful.
如果您熟悉Shopify使用的Liquid模板语言,这应该足以让您入门。通常,Shopify wiki非常有用。
#1
0
The user will need to be logged in for the following to work. If the user is logged in, then you can use the following code to display their orders. This will display only 3 orders.
用户需要登录才能使用以下内容。如果用户已登录,则可以使用以下代码显示其订单。这将只显示3个订单。
{% if customer.orders.size != 0 %}
<table>
<thead>
<tr>
<th class="order_number">Order</th>
<th class="date">Date</th>
<th class="payment_status">Payment Status</th>
<th class="fulfillment_status">Fulfillment Status</th>
<th class="total">Total</th>
</tr>
</thead>
<tbody>
{% for order in customer.orders limit:3 %}
<tr class="{% cycle 'odd', 'even' %} {% if order.cancelled %}cancelled_order{% endif %}">
<td>{{ order.name | link_to: order.customer_url }}</td>
<td><span class="note">{{ order.created_at | date: "%b %d, %Y" }}</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 %}
</tbody>
</table>
{% else %}
<p>You haven't placed any orders yet.</p>
{% endif %}
#2
0
When a customer is logged in, there will be a customer
liquid variable available with lots of data about the user. If you look through the docs, there is a member variable called order
which will give you an array of all of the users orders. There is also a variable called recent_order
which will give you the most recent order by the user.
当客户登录时,将有一个客户流量变量,其中包含大量有关用户的数据。如果查看文档,就会有一个名为order的成员变量,它将为您提供所有用户订单的数组。还有一个名为recent_order的变量,它将为您提供用户最近的订单。
If you are familiar with the Liquid template language used by Shopify, this should be enough to get you started. Generally, the Shopify wiki is very helpful.
如果您熟悉Shopify使用的Liquid模板语言,这应该足以让您入门。通常,Shopify wiki非常有用。