PageSourceSearch

https://xdiag.by/catalog/view/theme/unishop2/js/quick-order.js

js xdiag.by collected 2026-10-08 14:14:57 UTC 3,985 bytes, 122 lines download raw bytes

1function quick_order(id, flag) {
2	uniAddCss('catalog/view/theme/unishop2/stylesheet/quick_order.css');
3	uniAddJs('catalog/view/theme/unishop2/js/jquery.maskedinput.min.js');
4	
5	let is_product_page;
6	
7	if($('.product-page__add-to-cart').length && $('.product-page__add-to-cart').data('pid') == id) {
8		is_product_page = true;
9	}
10	
11	$.ajax({
12		url:'index.php?route=extension/module/uni_quick_order',
13		type:'post',
14		data:{'id':id, 'is_product_page': (typeof(is_product_page) != 'undefined' ? 1 : 0)},
15		dataType:'html',
16		success:function(data) {
17			$('html body').append(data);
18			$('#modal-quick-order').addClass(uniJsVars.popup_effect_in).modal('show');
19		}
20	});
21}
22
23function uniQuickOrderAdd() {
24	var form = '#modal-quick-order';
25	
26	$.ajax({
27		url: 'index.php?route=extension/module/uni_quick_order/add',
28		type: 'post',
29		data: $(form+' input, '+form+' textarea, '+form+' select').serialize(),
30		dataType: 'json',
31		beforeSend: function() {
32			$(form+' .add_to_cart').button('loading');
33		},
34		complete: function() {
35			$(form+' .add_to_cart').button('reset');
36		},
37		success: function(json) {
38			$('.text-danger').remove();
39				
40			$('.form-group').removeClass('has-error');
41			
42			if (json['error']) {
43				if (json['error']['option']) {
44					for (i in json['error']['option']) {							
45						
46						var element = $('#quick_order #input-option' + i.replace('_', '-'));
47						
48						if (element.parent().hasClass('input-group')) {
49							element.parent().after('<div class="text-danger">'+json['error']['option'][i]+'</div>');
50						} else {
51							element.after('<div class="text-danger">'+json['error']['option'][i]+'</div>');
52						}
53						
54						json['error'][i] = json['error']['option'][i];
55					}
56					
57					delete json['error']['option'];
58				}
59				
60				for (i in json['error']) {
61					form_error(form, i, json['error'][i]);
62				}
63				
64				uniFlyAlert('danger', json['error']);
65			}
66		
67			if (json['success']) {			
68				dataLayer.push({
69					'ecommerce':{
70						'currencyCode': uniJsVars.currency.code,
71						'purchase':{
72							'actionField':{
73								'id': json['success']['order_id'],
74								'goal_id': uniJsVars.quick_order.metric_taget_id
75							},
76							'products': json['success']['products']
77						}
78					}
79				});
80				
81				if (typeof(gtag) === 'function') {
82					dataLayer.push({
83						'event': "purchase",
84						'ecommerce': {
85							'transaction_id': json['success']['order_id'],
86							'currency': uniJsVars.currency.code,
87							'items': json['success']['items']
88						}
89					});
90					
91					//gtag('event', 'purchase', {'transaction_id': json['success']['order_id'], 'currency': uniJsVars.currency.code,	'items': json['success']['products']});
92				}
93				
94				if(uniJsVars.quick_order.metric_id && uniJsVars.quick_order.metric_target) {
95					if (typeof(ym) === 'function') {
96						ym(uniJsVars.quick_order.metric_id, 'reachGoal', uniJsVars.quick_order.metric_target);
97					} else {
98						new Function('yaCounter'+uniJsVars.quick_order.metric_id+'.reachGoal(\''+uniJsVars.quick_order.metric_target+'\')')();
99					}
100				}
101				
102				if(uniJsVars.quick_order.analytic_category && uniJsVars.quick_order.analytic_action) {
103					if (typeof(gtag) === 'function') {
104						gtag('event', uniJsVars.quick_order.analytic_action, {'event_category': uniJsVars.quick_order.analytic_category});
105					} else if (typeof(ga) === 'function') {
106						ga('send', 'event', uniJsVars.quick_order.analytic_category, uniJsVars.quick_order.analytic_action);
107					}
108				}
109				
110				$('#quick_order').html('<div class="row"><div class="col-xs-12">'+json['success']['text']+'</div></div>');
111				
112				setTimeout(() => {			
113					$('#modal-quick-order').modal('hide');
114				}, 5000);
115			}
116		},
117		error: function(xhr, ajaxOptions, thrownError) {
118            //alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
119			alert(xhr.responseText);
120        }
121	});
122}

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.