Programatically add product to cart
I was wondering if anyone had any example code for programatically adding a product to a visitors shopping cart.
Here's the scenario. I have a complicated registration form which pulls data from another system. I would like at the end of the process to add a product (event registration) to their shopping cart and then direct them to the payment processing.
I'm a beginning programmer, but I have created another form that imports events from the other system into Sitefinity. (see http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/import-events-from-different-database.aspx
) I was hoping there was something similar I can do for adding the product.
Bumping this up, hoping someone might have a response...
I started a similar thread around the same time as you and I'm waiting for an anwser as well. Seems like this should be easy to do but the lact of response from Telerik has me a bit concerned. My thread is located here: Using ecommerce for donations and adding items to cart programatically
I've found that there is an add to cart method for the orders manager, but I can't figure out how to get the cart order to input it.
Here is what I have so far:
Correction: It was a currency value that was needed. I modified the code and got this to work (almost).
Hi Amanda Shafer,
You can use the snippet below -
I tried using the code you provided. However, it appears as if it does not set the cookie at all. So when the user navigates to the car, nothing appears in there.
Through trial and error, I came up with this code. Don't know if it's the best way to go about it, but it does what I want.
Hello Amanda Shafer,
Yes, your sample should work, I can also give you utility methods to remove and set the cookie in case you need it.
Below are the snippets -
I'm having the same issue. I can see the cart order in "sf_ec_cart_order" and "sf_ec_cart_detail" tables. However I can't see the order in my shopping cart. I tried everything in this thread, but no success. Can anyone provide me little help please.
Nuwan, did you ever manage to get this working?