简体   繁体   English

在Magento中添加到购物车API

[英]Add to Cart API in Magento

I need to know how can I add products into cart using API. 我需要知道如何使用API​​将产品添加到购物车中。 I have a list of products with details, I am trying to call the API from outside Magento. 我有一个包含详细信息的产品列表,我正在尝试从Magento外部调用API。 In which Magento's core class implements this function?? Magento的核心类在哪个类中实现此功能?

Thanks in Advance.. 提前致谢..

magento uses MVC and by looking at the cart link you can extract the path to the module, however magento使用MVC,通过查看购物车链接,您可以提取到模块的路径,但是

 Mage_Checkout_CartController::addAction()

is the method you are looking for , remember that it is depending on session 是您要寻找的方法,请记住这取决于会话

In order to add to the cart you're going to have to implement your own API. 为了添加到购物车,您将必须实现自己的API。 That can be difficult because as Anton mentioned, it depends on session. 这可能很困难,因为正如Anton所说,这取决于会话。

There was a project out there at one time, Mammoth Web Services , by some guys in the UK, but the project has gone silent. 曾经有一个项目由英国的一些人在那里进行,名为Mammoth Web Services ,但该项目一直保持沉默。

If you have magento id's for your products this is fairly simple 如果您的产品具有magento ID,这相当简单

http://yoursite.com/index.php/checkout/cart/add?product=product_id&qty=qty http://yoursite.com/index.php/checkout/cart/add?product=product_id&qty=qty

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM