cancel
Showing results for 
Search instead for 
Did you mean: 

Add to cart submit form does not work

Add to cart submit form does not work

Dear All,

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)

 

Thanks.

 

Regards,

Max

 

 
3 REPLIES 3

Re: Add to cart submit form does not work

Hi @maxw_sms,

 

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.

Re: Add to cart submit form does not work

Hi Damian,

 

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.

Thanks.

 

Regards,

Max

Re: Add to cart submit form does not work

Hi @maxw_sms,

 

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.