Magento API V2 销售订单列表不起作用

发布于 2024-11-07 14:24:32 字数 444 浏览 0 评论 0原文

我正在使用 API V2“salesOrderList”来接收已在 Magento 中下达的所有订单的列表。但 SOAP 响应向我显示一个错误:-

Item (Mage_Sales_Model_Order) with the same id "1" already exist

我正在使用 Magento Enterprise 版本 1.9.0.0。

在研究了 SQL & 之后搜索数据库,我发现对于每个订单,SQL 为相同的订单实体 ID 提供了 4 条记录;区别仅在于账单和账单的名称字段。航运区。此外,该查询还使用两个不同的别名(一个用于计费,另一个用于运输)对同一数据库表“sales_flat_order_address”进行两次左连接。根据我的理解,这应该有效。

发生了什么情况,可以采取哪些措施来恢复此错误?

I am using the API V2 "salesOrderList" for receiving a list of all the Orders which have been placed in Magento. But the SOAP Response is showing me an error as:-

Item (Mage_Sales_Model_Order) with the same id "1" already exist

I am using Magento Enterprise version 1.9.0.0.

After looking into the SQL & searching the database, I found that for each Order, the SQL is providing 4 records for the same Order Entity ID; with the difference being only in the name fields of the billing & shipping area. Also the query is doing two Left Joins with the same database table "sales_flat_order_address" by using two different aliases (one for billing & another for shipping). From my understanding, this should have worked.

What is happening, and what can be done to recover from this error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷鸟归林 2024-11-14 14:24:32

粗略地说,Magento 正在为您创建一个订单集合并尝试加载所有记录。该集合有一个规则,只允许它为每个 ID 创建一个订单对象,因此当加载附加对象时,会引发异常。

左连接可能是问题所在,但很难立即说出来。您能否详细介绍一下如何进行 API 调用?不正确的连接通常会出现此问题。


编辑:

如果您使用默认代码,我的第一个猜测是数据库中存在错误记录,或者这是升级后的 Magento 系统,过去升级失败。在指向同一数据库的 EE 版本的干净副本上尝试此操作。如果出现同样的问题,您可能需要在数据库中查找有问题的数据加载的原因。由于您已经有了查询,因此您可能需要分离出查询的各个部分,以查看某些子查询是否返回过多的数据。

Roughly, Magento is creating an order collection for you and attempting to load all the records. This collection has a rule that only allows it to create one order object for each ID, so when your additional object is loaded an exception is thrown.

The left joins could be the issue, but it's hard to say off the bat. Could you post a little detail on how you are making the API call? An incorrect join can often have this problem.


EDIT:

If you're using the default code, my first guess would be that there are erroneous records in the database, or that this is an upgraded Magento system which had a bad upgrade in the past. Try this on a clean copy of your EE version pointing to the same database. If the same problem occurs, you may need to spelunk in the database looking for the reason for the problematic data load. Since you already have the query, you may want to separate out parts of the query to see if some subquery is returning too much data.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文