Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery("form[ID^=product_form]").submit(function() {
- jQuery('span#update_icon').css('visibility', 'visible');
- // use current url so empty basket keeps you on the same page
- // then remove any additional request on the url incase someone has emptied the basket and then trys to add product again
- var s = js_data.current_url;
- var n = s.indexOf('?');
- var current_url_stripped = s.substring(0, n != -1 ? n : s.length);
- form_values = jQuery(this).serialize();
- jQuery.post(current_url_stripped+"?ajax=true", form_values, function(returned_data) {
- if (returned_data.indexOf("bullet") >= 0) {
- // remove - validate the drop down menus if false exit
- jQuery('p.prod_form_required').remove();
- jQuery('p.added_note').remove();
- jQuery('div.dpsc-shopping-cart').html(returned_data);
- jQuery('span#update_icon').css('visibility', 'hidden');
- jQuery('div.added_note').show('blind');
- } else {
- jQuery('.prod_form_required').fadeOut();
- jQuery('div#product_form_wrap').append('<p class="prod_form_required">Please complete the \'required\' options above</p>');
- jQuery('span#update_icon').css('visibility', 'hidden');
- }
- });
- return false;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement