1BX.ready(function(){ 2 if(!BX.Sale || !BX.Sale.BasketComponent) 3 return; 4 5 logictimBasket('first'); 6}); 7 8BX.addCustomEvent('onAjaxSuccess', function(command,params) {logictimBasket(params);}); 9 10 11function logictimBasket(params) { 12 13 if(!BX.Sale || !BX.Sale.BasketComponent) 14 return; 15 16 if(!BX.Sale.BasketComponent.result.GRID.ROWS && BX.Sale.BasketComponent.result.BASKET_ITEM_RENDER_DATA) //DLYA ASPRO 17 BX.Sale.BasketComponent.result.GRID.ROWS = BX.Sale.BasketComponent.result.BASKET_ITEM_RENDER_DATA; 18 if(!BX.Sale.BasketComponent.result.GRID.ROWS) 19 return; 20 21 if(params.url == '/bitrix/components/logictim/bonus.ajax/bonus_cart_ajax.php') 22 return; 23 24 console.log(BX.Sale.BasketComponent.result.GRID.ROWS); 25 26 //CHECK CAN_BUY 27 var rows = []; 28 for(id in BX.Sale.BasketComponent.result.GRID.ROWS) { 29 var row = BX.Sale.BasketComponent.result.GRID.ROWS[id]; 30 if(row['CAN_BUY'] != 'N' && row['NOT_AVAILABLE'] != true) 31 rows[id] = row; 32 } 33 34 35 BX.ajax({ 36 url: '/bitrix/components/logictim/bonus.ajax/bonus_cart_ajax.php', 37 method: 'POST', 38 data: rows, 39 dataType: 'json', 40 onsuccess: function(result) { 41 setBonusInBasket(result); 42 } 43 }); 44} 45 46function setBonusInBasket(result) { 47 //console.log(result); 48 49 var itog_block = BX.findChild(BX('basket-root'), {'tag': 'div', 'class': 'basket-checkout-block-total-price-inner'}, true); 50 var bonus_all = BX.create('DIV', {props: {id: 'bonus_all'}, style: {order: '10'}, html: result.ALL_BONUS + ' ' + result.TEXT.TEXT_BONUS_FOR_ITEM}); 51 BX.remove(BX('bonus_all')); 52 53 if(parseFloat(result.ALL_BONUS) > 0) 54 itog_block.appendChild(bonus_all); 55 56 for(id in result.ITEMS) { 57 var item = result.ITEMS[id]; 58 var product_block = BX('basket-item-'+item.BASKET_ITEM_ID); 59 60 if(!product_block) 61 continue; 62 63 var price_blocks = BX.findChild(product_block, {'tag': 'div', 'class': 'basket-item-block-price'}, true, true); 64 var price_for_one = price_blocks[0]; 65 var price_for_item = price_blocks[1]; 66 var bonus_item = BX.create('DIV', {props: {id: 'bonus_item_'+item.BASKET_ITEM_ID, className: 'bonus bonus_item_cart'}, style: {order: '10'}, html: item.ADD_BONUS + ' ' + result.TEXT.TEXT_BONUS_FOR_ITEM}); 67 BX.remove(BX('bonus_item_'+item.BASKET_ITEM_ID)); 68 69 if(parseFloat(item.ADD_BONUS) > 0) 70 price_for_item.appendChild(bonus_item); 71 //console.log(price_for_one); 72 } 73 74 75}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.