• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

从Magento的SOAP查询结果集限制

用户头像
it1352
帮助1

问题说明

你怎么可以指定一个最大结果为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.

正确答案

#1

它似乎并不像它可以使用限制来完成,(再加上你会做一些复杂的分页逻辑来获取所有的记录,因为你需要知道记录的总数和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

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcfigjf
系列文章
更多 icon
同类精品
更多 icon
继续加载