Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function(){
- $('#delete-basket-item').live('click', function(){
- var deleted_products = [];
- $('.basket-item-checkbox:checked').each(function(){
- deleted_products.push($(this).attr('_code'))
- })
- if(deleted_products.length > 0){
- $.post('ajax/deleteProductsFromBasket',
- {
- 'products': deleted_products
- }, function(data, responseCode){
- if(util.check_response_status(responseCode)){
- $('#content-inner').html(data);
- util.show_message(util.__('The product(s) have successfully removed from basket'));
- }
- }
- );
- }else{
- util.show_error(util.__('You should select at least one product'));
- }
- return false;
- });
- $('#update-basket').live('click', function(){
- var products = [];
- $('.basket-item-checkbox').each(function(){
- var tmp = {};
- tmp.code = $(this).attr('_code');
- tmp.value = $(this).parent().find('.count').val();
- products.push(tmp)
- })
- $.post('ajax/updateProductsInBasket',
- {
- 'products': products
- }, function(data, responseCode){
- if(util.check_response_status(responseCode)){
- $('#content-inner').html(data);
- util.show_message(util.__('The basket have successfully updated'));
- }
- }
- );
- return false;
- });
- //proceed-order
- $("#proceed-order").live("click",function(){
- $('#proceed_form').submit(function(){
- return false;
- });
- $("#dialog").dialog("open");
- });
- $("#dialog").dialog({
- autoOpen: false,
- width: 700,
- buttons: {
- "I'd like to use an order number": function() {
- $(this).dialog("close");
- $("#confirm").dialog("open");
- },
- "No order number required - place order without": function() {
- $(this).dialog("close");
- proceed();
- }
- }
- });
- $("#confirm").dialog({
- autoOpen: false,
- width: 700,
- buttons: {
- "Place order": function() {
- $(this).dialog("close");
- reference = $('#order_num').val();
- $('#reference').attr({value:reference});
- proceed();
- },
- "No order number required - place order without": function() {
- $(this).dialog("close");
- proceed();
- }
- }
- });
- function proceed(){
- var products = [];
- $('.basket-item-checkbox').each(function(){
- var tmp = {};
- tmp.code = $(this).attr('_code');
- tmp.value = $(this).parent().find('.count').val();
- tmp.reference = $('#reference').val();
- products.push(tmp)
- })
- $('.preloader').show();
- $.post('ajax/proceedOrder',
- {
- 'products': products
- }, function(data, responseCode){
- if(util.check_response_status(responseCode)){
- $('#content-inner').html(data);
- util.show_message(util.__('Thank You! Your order has been processed, detailed information is below.'));
- }
- $('.preloader').hide();
- }
- );
- return false;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement