Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

how to add product to shopping cart with product option via a url querystring
 
frietfriet
Jr. Member
 
Total Posts:  9
Joined:  2009-02-27
 

I found this how to add a product to the cart using an URL.:

http://www.magentocommerce.com/wiki/adding_a_product_to_the_cart_via_querystring

I can specify the product and quantity in the url:
/path/to/app/checkout/cart/add?product=[id]&qty;=[qty]

I used this to automatically add a product to the cart from an (external) application with a url and it works.
What I need now is to specify a custom product option in the URL.
Is this possible?
How should the URL look like if it is possible?
if not possible: how can I otherwise add a product to the cart from an external application and specify
a custom option value?

thanks in advance.

 
Magento Community Magento Community
Magento Community
Magento Community
 
frietfriet
Jr. Member
 
Total Posts:  9
Joined:  2009-02-27
 

well frietfriet has the answer again wink

by studying the html source of the product page I can see in the form that there is an input
field for every required option. the name of the field is ‘options[2]’ for the option that
I have added (a string).

so I can add a product to the shopping cart with the design name set like this:

http://myshop.com/magento/index.php/checkout/cart/add?product=1&options;[2]=design684&qty;=1

voila!
I didn’t get much help from the board visitors but fortunately I can study the source code of magento
which is the ultimate user guide.
long live opensource!

 
Magento Community Magento Community
Magento Community
Magento Community
 
fragilem17
Member
 
Total Posts:  56
Joined:  2009-02-15
 

Hi frietfriet,

Thanks for adding this, but what if I want to add a product to the cart with a file option.. how would i go arround to do this?

thanks already!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top