evoShop({ cartStyle: "div", cartClass: "div", cartColumns: [ {attr: "rowTpl", label: false, view: 'rowTpl'} ], rowTpl: evoShopConfig['cart.orderRow'], tinyRowTpl: evoShopConfig['cart.cartPageRow'] }); evoShop.currency({ code: 'RUB', symbol: ' руб.', delimiter: " ", accuracy: 0, after: true }); evoShop.bind('ready update', function () { //evoShop with total text if (evoShop.quantity() === 0) { $('.cart_is_empty').show(); $('.cart_is_full').hide(); } else { $('.cart_is_empty').hide(); $('.cart_is_full').show(); } }); $(document).on('click', '.js-to-cart', function (e) { e.preventDefault(); var itemId = $(this).data('id'); var wrap = $(this).closest('.js-item-wrap'); var quantity = wrap.find('.js-item-quantity').val(); var config = $('.js-item-config:checked').val(); $.get('ajax-shop-item-data', { item: itemId, }, function (response) { response = JSON.parse(response); if (response['status']) { evoShop.add(response['data']); } else { alert('error') } }); }) ; $(document).on("click", ".js-order-btn", function (ev) { $(".evoShop_items_json").val(localStorage.getItem("evoShop_items").replace("}}", "} }")); ev.preventDefault() $('#order-form').closest('form').submit(); }); $('body').on('submit', '.order-form', function(e) { e.preventDefault(); var target = this; values = $(this).serializeArray(); $(".js-order-btn").prop('disabled',true); $.ajax({ type: 'POST', dataType: 'html', url: $(this).attr('data-url'), data: values, success: function(data) { $(target).replaceWith(data); $(".js-order-btn").prop('disabled',false); } }); }); //очистка if($('#clearCart').length){ evoShop.empty(); }