Good day!
In the catalog.section component there is a form for changing the quantity of goods, but the value was not transmitted by standard means of the bitrix. Got to understand, googled, tried everything that I found, but it does not work. As a result, I came to a script that passes / catalog /? Action = ADD2BASKET & id = 391 & quantity = 5 ( ? Action = ADD2BASKET & id = 391 from the $ arItemIDs ['BUY_LINK'] variable, the quantity variable is set and written correctly, jquery is pulled from the input ), but why in the end, the number in the basket is always 2, I can not understand why this could be so?
Script
$('.bx_bt_button.bx_medium').on('click',function(e){ if(!$(this).hasClass('success-btn')){ e.preventDefault(); $(this).addClass('success-btn'); $(this).text('В корзине'); var quantity = "&quantity=" + $(this).parents(".catalog_item_buy").find('input[name="quantity"]').val(); var url = $(this).attr('href') + quantity; console.log(url); $.ajax({ type:'POST', beforeSend:function(){ BX.showWait(); }, url:url, success:function(data){ BX.onCustomEvent('OnBasketChange'); $('.bx_big.bx_bt_button.bx_cart').attr({'href':'/personal/cart/'}); BX.closeWait(); }, }) } })
Standard JS did not touch
default
, then write in support of 1C-Bitrix. Otherwise, lay out the connection code of the component and the code of the template, where you carry out maipulation with the quantity. - Nikolaj Sarry