“添加到购物车 API” magento 工作吗?
有人可以使用magento的添加到购物车API吗?
$mage_url = 'http://server_path/magento/api/?wsdl';
$mage_user = 'xxxxx';
$mage_api_key = 'xxxxx';
// 初始化 SOAP 客户端 $soap = new SoapClient( $mage_url );
// 登录 Magento $session_id = $soap->login( $mage_user, $mage_api_key );
之后我想做添加到购物车
任何建议..
Did anyone got the Add to cart API of magento working?
$mage_url = 'http://server_path/magento/api/?wsdl';
$mage_user = 'xxxxx';
$mage_api_key = 'xxxxx';
// Initialize the SOAP client
$soap = new SoapClient( $mage_url );
// Login to Magento
$session_id = $soap->login( $mage_user, $mage_api_key );
after this i want to do Add to cart
any suggestion..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Magento 不通过 SOAP API 提供该功能(截至 2010 年 12 月版本 1.4.2)。您现在必须自己实施。棘手的事情是改变它,以便它为通过 SOAP 创建的购物车创建一个会话对象,而不是通过用户浏览器使用 cookie 传入的请求,并将所有内容发送到结账控制器。
该 API 在当前版本中唯一做的事情就是创建一个购物车对象。没有别的了。好吧,甚至不是真的。它只是为给定的商店 ID 创建一个报价对象。
正如此处 API 的实现类所示:
Magento doesn't yield that functionality via the SOAP API(yet as of Dec. 2010 version 1.4.2). You would have to make your own implementation for now. Tricky thing with that would be to change it so that it creates a session object for carts created via SOAP vs. a request coming in via a user's browser with cookie and all to the checkout controller.
The only thing the API does in the current release is create a cart object. Nothing else. Well not even really. It just creates a quote object for the given store ID.
As seen in the API's implementation class here: