Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/236.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用Shopify中以前订购的产品创建列表?_Php_Html_Css_Shopify - Fatal编程技术网

Php 如何使用Shopify中以前订购的产品创建列表?

Php 如何使用Shopify中以前订购的产品创建列表?,php,html,css,shopify,Php,Html,Css,Shopify,有没有办法在Shopify中创建以前订购的物品列表,以及图片? 基本上,我想要的是在首页上列出用户以前购买的3项商品。当客户登录时,将有一个customerliquid变量,其中包含大量关于用户的数据。如果查看,则有一个名为order的成员变量,它将为您提供所有用户订单的数组。还有一个名为recent\u order的变量,它将提供用户最近的订单 如果您熟悉Shopify使用的液体模板语言,这应该足以让您开始学习。通常,非常有用。用户需要登录才能执行以下操作。如果用户已登录,则可以使用以下代码显

有没有办法在Shopify中创建以前订购的物品列表,以及图片?
基本上,我想要的是在首页上列出用户以前购买的3项商品。

当客户登录时,将有一个
customer
liquid变量,其中包含大量关于用户的数据。如果查看,则有一个名为
order
的成员变量,它将为您提供所有用户订单的数组。还有一个名为
recent\u order
的变量,它将提供用户最近的订单


如果您熟悉Shopify使用的液体模板语言,这应该足以让您开始学习。通常,非常有用。

用户需要登录才能执行以下操作。如果用户已登录,则可以使用以下代码显示其订单。这将仅显示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 %}
{%if customer.orders.size!=0%}
命令
日期
支付状态
履行状态
全部的
{客户订单的百分比。订单限制:3%}
{{order.name | link_to:order.customer_url}
{{order.created_在{124;日期:“%b%d,%Y”}
{{order.financial_status}
{{order.fulfillment_status}
{{order.total{u price}money}
{%endfor%}
{%else%}
你还没有下订单

{%endif%}
我真的不知道该尝试什么您试图解决的解决方案是什么?您计划将这些信息用于何处等。您的问题实际上没有提供您试图解决的问题的太多细节。这是否需要特定于用户?这些用户以前是否登录过(通过用户帐户),或者您只是想做一些像炫耀流行物品之类的事情?这是关键,它应该是特定于用户的。如果您没有登录,您将看不到任何内容。查看javascript API,看看您是否可以访问用户帐户令牌或id。如果可以,请使用JSONP端点或提供用户购买(或放入以前废弃的购物车)的产品并显示它们。您可以编写自己的API,根据ShopifAPI的各个部分提供详细信息、产品链接和图像链接。