0

How can I add products with PHP to the customer's cart. Having customer's id and login details.

The login is successful. Just need to update the cart with the products, quantity and prices that user can also check from the magento site also.

2 Answers 2

1

The easy way? Just fire a ajax request to the page.

http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/catalog/adding_a_product_to_the_cart_via_querystring

/path/to/magento/checkout/cart/add?product=[id]&qty=[qty]

Maybe you have a problem with the SameOriginPolicy with JS, so you might use an iframe or image instead.

1
  • Sir with ajax i did but after that I am not able to retrieve the list of products using Mage. Jun 19, 2013 at 7:56
0

The API would work well for this.

Supports SOAP and REST.

http://www.magentocommerce.com/api/soap/introduction.html

2
  • I read about this yesterday but couldn't see how I define the customer or his cart to put things into, how does this work? May 31, 2013 at 6:51
  • @FabianBlechschmidt the checkout api has cart_customer.set and cart_product.add. You can fetch customer data with the customer api and set it with the checkout api. magentocommerce.com/api/soap/checkout/checkout.html. Hope this helps. May 31, 2013 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.