WP-e-Commerce Adding A Product via Flash Button
I have built a flash application where a user can customise a product. I currently have an 'add to basket' button within the flash application that doesn't do anything. I'd like it to add a product to the basket when clicked.
Writing a flash function with event clicks is no problem, but I'm not sure how to connect to the shopping basket and would appreciate any advice on how to do this.
It appears to be done in AJAX but I'm not confident in this. Any help would be greatly appreciated.
Thank you
Dean
EDIT AFTER MILO'S COMMENTS:
Thanks Milo. Once I understand how to invoke the existing "function wpsc_add_to_cart()" I'll try to make it more efficient and implement what you have suggested, but at the moment I'm struggling to invoke the existing one from within flash.
I've determined the JQuery I need to call from within Flash is the one below, but I don't know how to call it (it doesn't appear to have a function name like I'm used to seeing):
// Submit the product form using AJAX
jQuery("form.product_form").live('submit', function() {
// we cannot submit a file through AJAX, so this needs to return true to submit the form normally if a file formfield is present
file_upload_elements = jQuery.makeArray(jQuery('input[type=file]', jQuery(this)));
if(file_upload_elements.length 0) {
return true;
} else {
form_values = jQuery(this).serialize();
// Sometimes jQuery returns an object instead of null, using length tells us how many elements are in the object, which is more reliable than comparing the object to null
if(jQuery('#fancy_notification').length == 0) {
jQuery('div.wpsc_loading_animation',this).css('visibility', 'visible');
}
jQuery.post( 'index.php?ajax=true', form_values, function(returned_data) {
eval(returned_data);
jQuery('div.wpsc_loading_animation').css('visibility', 'hidden');
if(jQuery('#fancy_notification') != null) {
jQuery('#loading_animation').css("display", 'none');
//jQuery('#fancy_notificationimage').css("display", 'none');
}
});
wpsc_fancy_notification(this);
return false;
}
});
Any ideas how to call this JQuery from within Flash?
Thanks for your help so far
Topic flash plugin-wp-e-commerce Wordpress
Category Web