Add to Cart via POST or Query String (or other) from Flash

Here’s my situation:

Building a cart for a client that manufactures highly customizable workboots:dev site

We are also building a Flash based custom product configurator(?) ( custom boot builder ) where a site visitor can totally customize a boot and instantly see the boot change. After they have finished customizing the boot to their liking, they will click an “Add to Cart” button within the Flash movie which will need to submit their chosen options to the shopping cart and (drumroll please)… add them to the cart.

I’ve created a hiden product for the custom configured boots that has all of the potential options and price modifiers set up. Now I just need to make the cart think that the product was added from this hidden product details page and not from within a Flash movie.

I’m thinking that I am going to have to recreate all of the form data within flash for the product and simply POST that to the cart, but I’m wondering if I am going to have to deal with sessions or cookies or anything other than the POST data.

Or would it be best to send via query string (if the cart even accepts GET data)?

Any insights/words of wisdom/cautionary tales from anybody that has done something similar??? Would be nice to be spared a half day of experimenting.

Thanks in advance for your time, effort and talent.

Here’s what I do for sites that need to be able to add a product to the cart and then go immediately to checkout is (note this is for GET parameters only):

  1. Create a my_changes/controllers/customer/checkout.pre.php file
  2. Put logic to look for a $mode == ‘add_go’.
  3. extract the product code from the ACTION ($action) argument
  4. extract the quantity from the DISPATCH_EXTRA ($dispatch_extra) argument
  5. Look up the product code and get the product_id
  6. Create the cart in $_SESSION and add the product_id and quanity
  7. redirect to checkout.checkout

    So a link would look like:

    Buy Now

    If you only want to add to the cart (and not go to checkout), you would use ‘add’ instead 'of ‘add_go’ and not have to write any ‘pre’ controller.

    If you want to specify options, etc. then you’d post everything in an array called ‘product_data’ stuctured as appropriate for the fn_add_product_to_cart() function.

Thanks for the reply.

I realized I made a mistake in describing how things should work. What SHOULD happen, is the site visitor will customize the appearance of the boot in the Flash movie, and when they are done, click a “Purchase Now” button. This will then POST (or send via query string) their choices to CS-Cart and take them to the product details page for a “base” version of the boot they just customized. At this point they will then choose some additional options such as size and width, that were not part of the Flash customization (although I am now wondering if having everything happen in Flash and then going straight to cart might be better). When they have have selected their final options, they will then click on “Add to Cart”

So I guess what I need to actually figure out is how to go to a details page and dynamically preselect some options, or at least place the data from the Flash movie into a text field, or a cookie, or the session data, and then send that to the cart when they want to checkout.