从Magento的SOAP查询结果集限制

编程入门 行业动态 更新时间:2024-10-14 18:20:08
本文介绍了从Magento的SOAP查询结果集限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你怎么可以指定一个最大结果为Magento的SOAP查询设置?

How can you specify a max result set for Magento SOAP queries?

我是通过SOAP API查询Magento的匹配特定状态的订单列表。我们谁是时间太长,返回列表,所以我想将结果集限制,但是我没有看到这个参数一些远程主机。

I am querying Magento via SOAP API for a list of orders matching a given status. We have some remote hosts who are taking too long to return the list so I'd like to limit the result set however I don't see a parameter for this.

$orderListRaw = $proxy -> call ( $sessionId, 'sales_order.list', array ( array ( 'status' => array ( 'in' => $orderstatusarray ) ) ) );

我能看到我们找回数据(6分钟后),并已经能够处理超时等,但将preFER只是强制的最大结果集。

I was able to see that we do get data back (6 minutes later) and have been able to deal with timeouts, etc. but would prefer to just force a max result set.

推荐答案

它似乎并不像它可以使用限制来完成,(再加上你会做一些复杂的分页逻辑来获取所有的记录,因为你需要知道记录的总数和API不具有一个方法)查看API调用列表@的 www.magentocommerce/api/soap/sales/salesOrder/sales_order.list.html

It doesn't seem like it can be done using limit, (plus you would have to do some complex pagination logic to get all records, because you would need know the total number of records and the api does not have a method for that) See api call list @ www.magentocommerce/api/soap/sales/salesOrder/sales_order.list.html

但你可以做一个解决办法是使用复杂的过滤器,以限制创建日期结果集基地。 (调整过小时,一天或一周基本订购量)。

But what you could do as a work around is use complex filters, to limit the result set base on creation date. (adjust to ever hour, day or week base on order volume).

此外,由于您使用的状态类型(假设您正在排除更多的只是取消订单),你可能要考虑让所有的订单和跟踪的ORDER_ID /本地状态(仅适用于上述过程的那些状态),其余的并没有继续将订单ID列表,可能需要您注意稍后

Also, since you are using status type (assuming that you are excluding more that just cancel order), you may want to think about getting all order and keep track of the order_id/status locally (only process the ones with the above status) and the remainder that wasn't proceed would be a list of order id that may need your attention later on

伪code示例

$params = array(array( 'filter' => array( array( 'key' => 'status', 'value' => array( 'key' => 'in', 'value' => $orderstatusarray, ), ), ), 'complex_filter' => array( array( 'key' => 'created_at', 'value' => array( 'key' => 'gteq', 'value' => '2012-11-25 12:00:00' ), ), array( 'key' => 'created_at', 'value' => array( 'key' => 'lteq', 'value' => '2012-11-26 11:59:59' ), ), ) )); $orderListRaw = $proxy -> call ( $sessionId, 'sales_order.list', $params);

了解更多关于过滤@ www.magentocommerce/knowledge-base/entry/magento-for-dev-part-8-varien-data-collections

更多推荐

从Magento的SOAP查询结果集限制

本文发布于:2023-11-22 01:54:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1615520.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:查询结果   Magento   SOAP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!