I am very new to Magento. And try to integrate Magento to our existing site. Magento installed as xxx.com.xxx/magento without any problem.
I tried to add a existing simple product to shopping cart with form as below:
<form action="/magento/checkout/cart/add/" method="post" name="add-to-cart"> QTY:<input type="text" name="qty"> <input type="hidden" name="product" value="1" /> <input type="hidden" name="form_key" value=<?php echo $form_Key?>/> <input type="submit" value="Add to basket" /> </form>
But I got "You have no items in your shopping cart." after I submit form.
I might do something wrong. Is there anyone could give me some suggestion on how to add a product to cart with form. (My site is a simple PHP site)
Just to be clear, you want to use a form on your site to post the Add To Cart to Magento. Am I right? I mean, that form isn't Magento, is your static site.
Yes you are correct. My form is not a Magento form. The form is in my PHP site which is in the same domain as Magento.
I'm not sure if I can pick the most elegant solution. You can post your data to a custom controller to handle the request or maybe you can try using the API.
I'm not sure which approach will work better for you. I was search a little bit and I haven't found elegant solutions yet.