api - Magento SOAP 无法创建订单

标签 api magento soap

问题

我在使用 Magento SOAP API 创建订单时遇到问题。我已经准备好了所有必需品(下面的代码片段),但每次我尝试创建订单时都会失败,状态代码为 1008(请参阅 Magento Docs )。

但是没有错误消息,所以我只知道订单创建失败。

$cart_id                 = $magi->execute("cart.create");
$customerEntity          = $magi->execute("customer.info",5);
$customerEntity["mode"] = "customer";

$customerAddressEntity         = $magi->execute("customer_address.info",$customerEntity["default_billing"]);
$customerAddressEntity["mode"] = "billing";

$magi->execute("cart_customer.set", array($cart_id,$customerEntity));
$magi->execute("cart_customer.addresses", array($cart_id,array($customerAddressEntity)));

$productEntity = array("product_id" => 48,"qty" => 1);

$magi->execute("cart_product.add",array($cart_id,array($productEntity)));
$magi->execute("cart_payment.method",array($cart_id,array("method" => "banktransfer")));

$orderId = $magi->execute("cart.order", array($cart_id));

在此操作后,magento 日志中会记录以下消息。


未定义偏移量:0/var/www/cloud2u.nl/mccloud_n/app/code/core/Mage/Checkout/Model/Cart/Payment/Api.php

undefined variable :websiteId/var/www/cloud2u.nl/mccloud_n/app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php。
(此条目在该条目之后重复 3 次,每次相隔半秒)。


我在这里不知所措,几周前它还处于工作状态,从那以后没有太大变化。

更多信息

$magi 变量保存一个对象,该对象是使用 Magento Soap api 的抽象。它还捕获并记录所有错误,因此此代码中没有 try/catch block 。

  • Magento 版本:1.7.0.0
  • PHP 版本 5.4.6
  • 服务器操作系统:Ubuntu 11.10(开发服务器)

最佳答案

Undefined offset: 0/var/www/cloud2u.nl/mccloud_n/app/code/core/Mage/Checkout/Model/Cart/Payment/Api.php

该错误表示存在一个数组没有 [ '0' ]

关于api - Magento SOAP 无法创建订单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10996520/

相关文章:

javascript - 使用 Grunt 和 grunt-uncss 删除大型 Magento 网站上未使用的 css 样式

java - 由于 java 中缺少证书(基于 XML SOAP)而导​​致使用 Web 服务时出错

java - Angular POST RESTful API 到 Ejb 导致 404 未找到错误

mysql - 在 MySQL 中使用 getopt lib 时出现可疑内存泄漏?

magento - 是否可以使用 Twitter Bootstrap 创建 Magento 网站?

c# - 授权 : Basic in client for SOAP Service

java - 如何使用 CXF 获取发件人公钥?

iphone - 在 iPhone 应用程序中验证用户身份

javascript - 在 getJSON jquery 中使用变量作为 URL

php - 在 magento 下订单后库存数量未更新