PageSourceSearch

https://auraf.ru/bitrix/templates/aura-flowers-new/js/buy/buy.js

js auraf.ru collected 2026-10-07 17:01:21 UTC 5,575 bytes, 171 lines download raw bytes

1function retail_basket(){
2    console.log("start_retail");
3    var url = document.location.href;
4    
5    $.post(url, {}, function(result){
6        try {
7            var $parsed = $($.parseHTML(result));
8            var component_resultation = $parsed.find(".top-user-basket");
9            
10            if (component_resultation.length) {
11                $(".top-user-basket").html(component_resultation.html());
12                
13                // Обновляем мобильную корзину
14                var $cartValue = $parsed.find(".new-cart__content-value").first();
15                var $cartPrice = $parsed.find(".basket-price");
16                
17                if ($cartValue.length) $(".new-cart__content-value").text($cartValue.text());
18                if ($cartPrice.length) $(".new-cart__content-value").last().text($cartPrice.text());
19            }
20        } catch(e) {
21            console.error('Ошибка обновления корзины:', e);
22            location.reload();
23        }
24    }, 'html');
25    
26    console.log("find_retail");
27}
28
29//function retail_basket(){
30//    console.log("start_retail");
31//    var url = document.location.href;
32//    $.post(url, {}, function(result){
33//        var component_resultation = $(result).find(".top-user-basket");
34//        $(".top-user-basket").html($(component_resultation).html());
35
36//    });
37//    console.log("find_retail");
38//}
39function ajaxBuy(id, quantity, decorEnable, isFormCard, dopId, prices = null) {
40    BX.showWait();
41    var params = {};
42    params.id = id;
43    params.quantity = quantity;
44    params.action= "ADD2BASKET";
45    if(decorEnable){
46        params.dopId=dopId;
47    }
48
49    var cost = $("#price_" + id).html()
50
51    if(typeof cost === 'undefined'){
52        cost = $("#allPrice").html()
53    }
54
55	console.log(params);
56
57    $.getJSON('/ajax/buy.php',params, function (data) {
58        $.each(data, function (key, val) {
59            console.log('dd');
60            console.log(isFormCard);
61            console.log('dd');
62            $("#orderNum").html(val.result);
63            $("#cardName").html(val.name);
64            $("#cardArticle").html($(".articul").html());
65            $("#cardPrice").html(quantity+" шт. "+val.cost_+" руб.");
66            // $("#cardPrice").html(quantity+" шт."+ summ);
67            $("#cardFotoImg").attr("src",val.img);
68            $("#cardFotoImg").attr("alt",val.name);
69
70            if (isFormCard) {
71							var targetContainer = $('.order__wrap');         //  Контейнер, в котором хранятся элементы
72                // var   url =  'https://auraf.ru/personal/order/make/';    //  URL, из которого будем брать элементы
73                //
74                // if (url !== undefined) {
75                //     $.ajax({
76                //         type: 'GET',
77                //         url: url,
78                //         dataType: 'html',
79                //         success: function(data){
80                //             //  Удаляем старую навигацию
81                //             $('.summary').remove();
82                //
83                //             var elements = $(data).find('.summary')  //  Ищем элементы
84                //             console.log($(data).html())
85                //             targetContainer.append(elements);
86                //
87                //         }
88                //     })
89                // }
90
91                var url = window.location.href.split('?')[0];
92                BX.ajax({
93                    url: url,
94                    method: 'POST',
95                    data: {'SCODER_AJAX':'Y'},
96                    onsuccess: function(data){
97                        $('.summary').remove();
98
99                                    // var elements = $(data).find('.summary')  //  Ищем элементы
100                                    // console.log($(data).html())
101                                    // targetContainer.append(elements);
102                        //console.log($(data).find('.summary'))
103                        targetContainer.prepend($(data).find('.summary'));
104                    },
105                });
106
107            }
108
109            else {
110                $.fancybox({
111                    padding: 0,
112                    'speedIn':500,
113                    'speedOut':300,
114                    'href':'#order',
115                    helpers:{
116                        overlay:{
117                            locked:false
118                        }
119                    }
120                });
121               
122            }
123            BX.closeWait();
124        });
125    });
126}
127
128function sayHi() {
129    retail_basket();
130  }
131function buyItem(id, offer, prices=null) {
132
133    var idElement = id;
134
135    var quantity = $("#quantity_" + id).html();
136    if(typeof quantity === 'undefined'){
137        quantity = 1;
138    }
139    if(offer){
140        idElement=$("input[name='offer']:checked").val();
141    }
142    var dopId=[];
143    $("input[name='dop']:checked").each(function() {
144        dopId.push($(this).val());
145    });
146    var decorEnable=false;
147
148    if((dopId.length)>0){
149        decorEnable=true;
150    }
151    if(typeof idElement === 'undefined'){
152      idElement = id;
153    }
154    ajaxBuy(idElement, quantity, decorEnable, false,dopId, prices);
155    setTimeout(sayHi, 1500);
156    
157 
158
159}
160
161function buyItemFormCard(id) {
162    ajaxBuy(id, 1, false, true,null);
163    //BX.onCustomEvent('OnBasketChange');
164   
165}
166
167function delItem(id) {
168    $.get('/ajax/del.php?action=DEL&id=' + id, function (data) {
169        location.reload();
170    });
171}

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.