从Magento的SOAP查询结果集限制 [英] Limiting resultset from Magento SOAP query

查看:171
本文介绍了从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调用列表@的 http://www.magentocommerce.com/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 @ http://www.magentocommerce.com/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);

了解更多关于过滤@ <一个href=\"http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-8-varien-data-collections\" rel=\"nofollow\">http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-8-varien-data-collections

这篇关于从Magento的SOAP查询结果集限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆