-
-
Save CrazyBoy49z/a350f688940e4bfe3d3d59b8f93d7b0f to your computer and use it in GitHub Desktop.
товары в корзину одним набюором
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on('click', 'button[name="ms2_action_set"][value="cart/addset"]', function(e) { | |
var parentSelector = '.mssetincart-row'; | |
var formSelector = '.ms2_form'; | |
var sets = { | |
action: 'cart/add', | |
ctx: miniShop2Config.ctx, | |
id: 0, | |
count: 1, | |
options: [] | |
}; | |
$.each($(parentSelector).find(formSelector), function(i, el) { | |
var $el = $(el); | |
sets = $.extend({}, sets, { | |
id: $el.find('input[name="id"]').val() || 0, | |
count: $el.find('input[name="count"]').val() || 1 | |
}); | |
$.ajax({ | |
url: miniShop2Config.actionUrl, | |
type: 'POST', | |
dataType: 'json', | |
async: false, | |
data: sets, | |
success: function(response) { | |
if (response.success) { | |
miniShop2.Cart.status(response.data); | |
miniShop2.Message.success(response.message); | |
} else { | |
miniShop2.Message.error(response.message); | |
} | |
} | |
}); | |
}); | |
return false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment