简体   繁体   中英

Add to Cart API in Magento

I need to know how can I add products into cart using API. I have a list of products with details, I am trying to call the API from outside Magento. In which Magento's core class implements this function??

Thanks in Advance..

magento uses MVC and by looking at the cart link you can extract the path to the module, however

 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. That can be difficult because as Anton mentioned, it depends on session.

There was a project out there at one time, Mammoth Web Services , by some guys in the UK, but the project has gone silent.

If you have magento id's for your products this is fairly simple

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

http://www.magentocommerce.com/download/release_notes#Release%20Notes%20-%20Magento%201.4.2.0%20%28December%208,%202010%29

included in 1.4.2.0 apparently, though not on the official API documentation yet

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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