scripts.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. (function(window, $) {
  2. var frontend = function(window, $) {
  3. var ShopProductsLightGalleryLastImage = '';
  4. // Private
  5. function ShopProductsInitLightGallery() {
  6. $('#product_thumbnails').lightGallery({
  7. pager: false,
  8. showThumbByDefault: false,
  9. toogleThumb: false,
  10. controls: false,
  11. download: false
  12. });
  13. $('#product_image img').css('cursor', 'pointer').click(function() {
  14. $($('#product_thumbnails a.thumbnail').get($(this).data('index'))).click();
  15. });
  16. $('#product_thumbnails a.thumbnail').each(function() {
  17. $(this).mouseover(function() {
  18. if($(this).data('hover') != ShopProductsLightGalleryLastImage) {
  19. ShopProductsLightGalleryLastImage = $(this).data('hover');
  20. $('#product_image img').attr('src', $(this).data('hover'));
  21. $('#product_image img').data('index', $(this).data('index'));
  22. }
  23. });
  24. });
  25. };
  26. function ShopBasketBlockObject(object) {
  27. if(object && !$(object).hasClass('click-blocked')) {
  28. $(object).addClass('click-blocked');
  29. }
  30. };
  31. function ShopBasketUnBlockObject(object) {
  32. if(object && $(object).hasClass('click-blocked')) {
  33. $(object).removeClass('click-blocked');
  34. }
  35. };
  36. function ShopBasketObjectIsNotBlocked(object) {
  37. if(!object) {
  38. return true;
  39. }
  40. return !$(object).hasClass('click-blocked');
  41. };
  42. function ShopBasketSetNavBtnProductsCount(value) {
  43. $('#basket-nav-btn .badge').html(value);
  44. $('#basket-mobile-btn').html(value);
  45. };
  46. function ShopBasketAjaxCommand(cmd, product_id, success, fail, always) {
  47. $.ajax({
  48. type: "GET",
  49. dataType: 'json',
  50. url: '/shop/basket/' + cmd + '/' + product_id + '/'
  51. }).done(function(data) {
  52. if(success) { success(data); }
  53. }).fail(function(xhr, status, error) {
  54. if(fail) { fail(xhr, status, error); }
  55. }).always(function() {
  56. if(always) { always(); }
  57. });
  58. };
  59. function ShopBasketAjaxGetInfo(success, fail, always) {
  60. $.ajax({
  61. type: "GET",
  62. dataType: 'json',
  63. url: '/shop/basket/info/'
  64. }).done(function(data) {
  65. if(success && data) { success(data); }
  66. }).fail(function(xhr, status, error) {
  67. if(fail) { fail(xhr, status, error); }
  68. }).always(function() {
  69. if(always) { always(); }
  70. });
  71. };
  72. function ShopBasketAjaxGetCount(success, fail, always) {
  73. ShopBasketAjaxGetInfo(function(data) {
  74. if(success && data && data.total_count != undefined) {
  75. success(data.total_count);
  76. }
  77. }, function(xhr, status, error) {
  78. if(fail) { fail(xhr, status, error); }
  79. }, function() {
  80. if(always) { always(); }
  81. });
  82. };
  83. function ShopBasketAjaxUpdateCount() {
  84. ShopBasketAjaxGetCount(function(count) {
  85. ShopBasketSetNavBtnProductsCount(count);
  86. });
  87. };
  88. function ShopBasketAjaxProductsHtml(success, fail, always) {
  89. ShopBasketAjaxGetInfo(function(data) {
  90. if(data) {
  91. if(data.total_count != undefined && data.total_count > 0) {
  92. var table = '';
  93. table += '<table class="table data-table table-striped table-bordered">';
  94. table += '<thead><tr><th class="thc-1">&nbsp;</th><th class="thc-2">' + ShopBasketTableProduct + '</th><th class="thc-3">' + ShopBasketTablePrice + '</th><th class="thc-4">' + ShopBasketTableQuantity + '</th><th class="thc-5">' + ShopBasketTableSum + '</th><th class="thc-6">&nbsp;</th></tr></thead>';
  95. table += '<tbody>';
  96. for(var i in data.products) {
  97. table += '<tr>';
  98. table += '<td class="thc-1 d-none d-md-table-cell"><img src="' + data.products[i].image + '" width="50" height="50" /></td>';
  99. table += '<td class="thc-2"><a href="' + data.products[i].link + '">' + data.products[i].name + '</a></td>';
  100. table += '<td class="thc-3">' + data.products[i].price + ' ' + data.currency.code + '</td>';
  101. table += '<td class="thc-4"><button type="button" class="btn btn-minus" onclick="frontend.ShopBasketProductMinus(this,' + data.products[i].id + ');"><span>-</span></button><input class="form-control" type="text" value="' + data.products[i].quantity + '" readonly><button type="button" class="btn btn-plus" onclick="frontend.ShopBasketProductPlus(this,' + data.products[i].id + ');"><span>+</span></button></td>';
  102. table += '<td class="thc-5">' + data.products[i].sum + ' ' + data.currency.code + '</td>';
  103. table += '<td class="thc-6"><a href="" onclick="frontend.ShopBasketProductRemove(this,' + data.products[i].id + ');return false;">&times;</a></td>';
  104. table += '</tr>';
  105. }
  106. table += '</tbody>';
  107. table += '</table>';
  108. table += '<div class="total"><span class="caption">' + ShopBasketTotal + '</span><span class="value">' + data.total_sum + ' ' + data.currency.code + '</span></div>';
  109. if(success) { success(table, data.total_count); }
  110. } else {
  111. if(success) { success(ShopBasketEmpty, 0); }
  112. }
  113. } else {
  114. window.location.reload(true);
  115. }
  116. }, function(xhr, status, error) {
  117. if(fail) { fail(xhr, status, error); }
  118. }, function() {
  119. if(always) { always(); }
  120. });
  121. };
  122. function ShopBasketEnableDisableOrderBtn(total) {
  123. $('#sys-modal-shop-basket button.btn-order').prop('disabled', total <= 0);
  124. };
  125. function ClearOrderFormErrorMessage() {
  126. $('#sys-modal-shop-basket .modal-body .order-form .sys-messages').html('');
  127. $('#sys-modal-shop-basket .modal-body .order-form .input-error-msg').css('display', 'none');
  128. };
  129. function ShowOrderFormErrorMessage(title, message) {
  130. $('#sys-modal-shop-basket .modal-body .order-form .sys-messages').html('<div class="alert alert-danger alert-dismissible fade show" role="alert"><strong>' + title + '</strong> ' + message + '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>');
  131. };
  132. function Initialize() {
  133. // Check if jQuery was loaded
  134. if(typeof $ == 'function') {
  135. ShopProductsInitLightGallery();
  136. } else {
  137. console.log('Error: jQuery is not loaded!');
  138. }
  139. };
  140. // Initialize
  141. if(window.addEventListener) {
  142. // W3C standard
  143. window.addEventListener('load', Initialize, false);
  144. } else if(window.attachEvent) {
  145. // Microsoft
  146. window.attachEvent('onload', Initialize);
  147. };
  148. // Public
  149. return {
  150. ShopBasketBtnCollapse: function() {
  151. if(!$('.navbar-toggler').hasClass('collapsed')) {
  152. $('.navbar-toggler').click();
  153. }
  154. return true;
  155. },
  156. ShopBasketOpen: function(object) {
  157. if(ShopBasketObjectIsNotBlocked(object)) {
  158. ShopBasketBlockObject(object);
  159. var html = '<div class="modal fade" id="sys-modal-shop-basket" tabindex="-1" role="dialog" aria-labelledby="sysModalShopBasketLabel" aria-hidden="true"> \
  160. <div class="modal-dialog modal-dialog-centered" role="document"> \
  161. <div class="modal-content"> \
  162. <input type="hidden" name="action" value="index-user-update-profile"> \
  163. <div class="modal-header"> \
  164. <h5 class="modal-title" id="sysModalShopBasketLabel">' + ShopBasketName + '</h5> \
  165. <button type="button" class="close" data-dismiss="modal" aria-label="Close"> \
  166. <span aria-hidden="true">&times;</span> \
  167. </button> \
  168. </div> \
  169. <div class="modal-body text-left" style="position:relative;"> \
  170. <div class="blocker" style="position:absolute;left:0px;top:0px;width:100%;height:100%;background:#fff;opacity:0.5;display:none;"></div> \
  171. <div class="data"></div> \
  172. <div class="order-form mt-3" style="display:none;"> \
  173. <hr class="mb-4"> \
  174. <form class="data-form" action="/" method="post" autocomplete="off"> \
  175. <div class="hidden"><input type="hidden" name="action" value="shop-order"></div> \
  176. <div class="row"> \
  177. <div class="col-md-6"> \
  178. <div class="form-group"> \
  179. <div class="row"> \
  180. <div class="col-md-4"> \
  181. <label for="lbl_client_last_name">' + ShopOrderLabelLastName + '</label> \
  182. </div> \
  183. <div class="col-md-8"> \
  184. <div> \
  185. <input class="form-control" type="text" id="lbl_client_last_name" name="client_last_name" minlength="1" maxlength="64" autocomplete="off" onkeydown="$(this).parent().parent().find(\'.input-error-msg\').css(\'display\', \'none\');"> \
  186. </div> \
  187. <div class="input-error-msg" style="display:none;"> \
  188. <small>' + ShopOrderEmptyLastName + '</small> \
  189. </div> \
  190. </div> \
  191. </div> \
  192. </div> \
  193. <div class="form-group"> \
  194. <div class="row"> \
  195. <div class="col-md-4"> \
  196. <label for="lbl_client_first_name">' + ShopOrderLabelFirstName + '</label> \
  197. </div> \
  198. <div class="col-md-8"> \
  199. <div> \
  200. <input class="form-control" type="text" id="lbl_client_first_name" name="client_first_name" minlength="1" maxlength="64" autocomplete="off" onkeydown="$(this).parent().parent().find(\'.input-error-msg\').css(\'display\', \'none\');"> \
  201. </div> \
  202. <div class="input-error-msg" style="display:none;"> \
  203. <small>' + ShopOrderEmptyFirstName + '</small> \
  204. </div> \
  205. </div> \
  206. </div> \
  207. </div> \
  208. <div class="form-group"> \
  209. <div class="row"> \
  210. <div class="col-md-4"> \
  211. <label for="lbl_client_middle_name">' + ShopOrderLabelMiddleName + '</label> \
  212. </div> \
  213. <div class="col-md-8"> \
  214. <div> \
  215. <input class="form-control" type="text" id="lbl_client_middle_name" name="client_middle_name" minlength="1" maxlength="64" autocomplete="off" onkeydown="$(this).parent().parent().find(\'.input-error-msg\').css(\'display\', \'none\');"> \
  216. </div> \
  217. <div class="input-error-msg" style="display:none;"> \
  218. <small>' + ShopOrderEmptyMiddleName + '</small> \
  219. </div> \
  220. </div> \
  221. </div> \
  222. </div> \
  223. </div> \
  224. <div class="col-md-6"> \
  225. <div class="form-group"> \
  226. <div class="row"> \
  227. <div class="col-md-4"> \
  228. <label for="lbl_client_phone">' + ShopOrderLabelMobilePhone + '</label> \
  229. </div> \
  230. <div class="col-md-8"> \
  231. <div> \
  232. <input class="form-control" type="text" id="lbl_client_phone" name="client_phone" minlength="1" maxlength="20" autocomplete="off" onkeydown="$(this).parent().parent().find(\'.input-error-msg\').css(\'display\', \'none\');"> \
  233. </div> \
  234. <div class="input-error-msg" style="display:none;"> \
  235. <small>' + ShopOrderEmptyMobilePhone + '</small> \
  236. </div> \
  237. </div> \
  238. </div> \
  239. </div> \
  240. <div class="form-group"> \
  241. <div class="row"> \
  242. <div class="col-md-4"> \
  243. <label for="lbl_client_email">' + ShopOrderLabelEmailAddress + '</label> \
  244. </div> \
  245. <div class="col-md-8"> \
  246. <div> \
  247. <input class="form-control" type="text" id="lbl_client_email" name="client_email" minlength="1" maxlength="64" autocomplete="off" onkeydown="$(this).parent().parent().find(\'.input-error-msg\').css(\'display\', \'none\');"> \
  248. </div> \
  249. <div class="input-error-msg" style="display:none;"> \
  250. <small>' + ShopOrderEmptyEmailAddress + '</small> \
  251. </div> \
  252. </div> \
  253. </div> \
  254. </div> \
  255. <div class="form-group"> \
  256. <div class="row"> \
  257. <div class="col-md-4"> \
  258. <label for="lbl_client_delivery_comment">' + ShopOrderLabelDelivery + '</label> \
  259. </div> \
  260. <div class="col-md-8"> \
  261. <div> \
  262. <input class="form-control" type="text" id="lbl_client_delivery_comment" name="client_delivery_comment" minlength="1" maxlength="255" autocomplete="off" onkeydown="$(this).parent().parent().find(\'.input-error-msg\').css(\'display\', \'none\');"> \
  263. </div> \
  264. <div class="input-error-msg" style="display:none;"> \
  265. <small>' + ShopOrderEmptyDelivery + '</small> \
  266. </div> \
  267. </div> \
  268. </div> \
  269. </div> \
  270. </div> \
  271. </div> \
  272. <div class="form-group"> \
  273. <div class="row"> \
  274. <div class="col-md-12 d-table-cell d-md-none"> \
  275. <label for="lbl_client_order_comment">' + ShopOrderLabelComment + '</label> \
  276. </div> \
  277. <div class="col-md-12"> \
  278. <div> \
  279. <textarea class="form-control" id="lbl_client_order_comment" name="client_order_comment" autocomplete="off" onkeydown="$(this).parent().parent().find(\'.input-error-msg\').css(\'display\', \'none\');"></textarea> \
  280. </div> \
  281. <div class="input-error-msg" style="display:none;"> \
  282. <small>' + ShopOrderEmptyComment + '</small> \
  283. </div> \
  284. </div> \
  285. </div> \
  286. </div> \
  287. <button type="submit" style="display:none;"></button> \ \
  288. </form> \
  289. <div class="sys-messages"></div>\
  290. </div> \
  291. </div> \
  292. <div class="modal-footer"> \
  293. <button type="button" class="btn btn-close btn-secondary" data-dismiss="modal">' + ShopBasketBtnContinue + '</button> \
  294. <button type="button" class="btn btn-order btn-success" onclick="frontend.ShopBasketMakeOrder(this);return false;" disabled>' + ShopBasketBtnOrder + '</button> \
  295. </div> \
  296. </div> \
  297. </div> \
  298. </div>';
  299. $('#sys-modal-shop-basket-placeholder').html(html);
  300. $('#sys-modal-shop-basket .order-form form').submit(function(e) {
  301. $('#sys-modal-shop-basket .modal-footer button.btn-success').click();
  302. e.preventDefault();
  303. });
  304. $("#sys-modal-shop-basket").modal({
  305. backdrop: 'static',
  306. keyboard: true,
  307. show: false,
  308. });
  309. $('#sys-modal-shop-basket').on('hidden.bs.modal', function(e) {
  310. $('#sys-modal-shop-basket-placeholder').html('');
  311. $('#navbar-top').css('margin-right', $('#body').css('padding-right'));
  312. });
  313. ShopBasketAjaxProductsHtml(function(html, total) {
  314. $('#sys-modal-shop-basket .modal-body .data').html(html);
  315. ShopBasketEnableDisableOrderBtn(total);
  316. $("#sys-modal-shop-basket").modal('show');
  317. $('#navbar-top').css('margin-right', $('#body').css('padding-right'));
  318. }, function(xhr, status, error) {
  319. window.location.reload(true);
  320. });
  321. ShopBasketUnBlockObject(object);
  322. }
  323. return false;
  324. },
  325. ShopBasketProductAdd: function(object, product_id) {
  326. if(ShopBasketObjectIsNotBlocked(object)) {
  327. ShopBasketBlockObject(object);
  328. ShopBasketAjaxCommand('plus', product_id, function(data) {
  329. frontend.ShopBasketOpen();
  330. }, function(xhr, status, error) {
  331. window.location.reload(true);
  332. }, function() {
  333. ShopBasketAjaxUpdateCount();
  334. ShopBasketUnBlockObject(object);
  335. });
  336. }
  337. return false;
  338. },
  339. ShopBasketProductPlus: function(object, product_id) {
  340. if(ShopBasketObjectIsNotBlocked(object)) {
  341. ShopBasketBlockObject(object);
  342. $('#sys-modal-shop-basket .modal-body .blocker').css('display', 'block');
  343. ShopBasketAjaxCommand('plus', product_id, function(data) {
  344. ShopBasketAjaxProductsHtml(function(html, total) {
  345. $('#sys-modal-shop-basket .modal-body .data').html(html);
  346. ShopBasketEnableDisableOrderBtn(total);
  347. }, function(xhr, status, error) {
  348. window.location.reload(true);
  349. });
  350. }, function(xhr, status, error) {
  351. window.location.reload(true);
  352. }, function() {
  353. ShopBasketAjaxUpdateCount();
  354. ShopBasketUnBlockObject(object);
  355. $('#sys-modal-shop-basket .modal-body .blocker').css('display', 'none');
  356. });
  357. }
  358. return false;
  359. },
  360. ShopBasketProductMinus: function(object, product_id) {
  361. if(ShopBasketObjectIsNotBlocked(object)) {
  362. ShopBasketBlockObject(object);
  363. $('#sys-modal-shop-basket .modal-body .blocker').css('display', 'block');
  364. ShopBasketAjaxCommand('minus', product_id, function(data) {
  365. ShopBasketAjaxProductsHtml(function(html, total) {
  366. $('#sys-modal-shop-basket .modal-body .data').html(html);
  367. ShopBasketEnableDisableOrderBtn(total);
  368. }, function(xhr, status, error) {
  369. window.location.reload(true);
  370. });
  371. }, function(xhr, status, error) {
  372. window.location.reload(true);
  373. }, function() {
  374. ShopBasketAjaxUpdateCount();
  375. ShopBasketUnBlockObject(object);
  376. $('#sys-modal-shop-basket .modal-body .blocker').css('display', 'none');
  377. });
  378. }
  379. return false;
  380. },
  381. ShopBasketProductRemove: function(object, product_id) {
  382. if(ShopBasketObjectIsNotBlocked(object)) {
  383. ShopBasketBlockObject(object);
  384. $('#sys-modal-shop-basket .modal-body .blocker').css('display', 'block');
  385. ShopBasketAjaxCommand('remove', product_id, function(data) {
  386. ShopBasketAjaxProductsHtml(function(html, total) {
  387. $('#sys-modal-shop-basket .modal-body .data').html(html);
  388. ShopBasketEnableDisableOrderBtn(total);
  389. }, function(xhr, status, error) {
  390. window.location.reload(true);
  391. });
  392. }, function(xhr, status, error) {
  393. window.location.reload(true);
  394. }, function() {
  395. ShopBasketAjaxUpdateCount();
  396. ShopBasketUnBlockObject(object);
  397. $('#sys-modal-shop-basket .modal-body .blocker').css('display', 'none');
  398. });
  399. }
  400. return false;
  401. },
  402. ShopBasketMakeOrder: function(object) {
  403. if(ShopBasketObjectIsNotBlocked(object)) {
  404. var OrderFormBlock = $('#sys-modal-shop-basket .modal-body .order-form');
  405. if(OrderFormBlock.css('display') == 'none') {
  406. OrderFormBlock.css('display', 'block');
  407. setTimeout(function() { OrderFormBlock.find('input.form-control').first().focus(); }, 200);
  408. return;
  409. }
  410. ClearOrderFormErrorMessage();
  411. var OrderForm = $('#sys-modal-shop-basket .modal-body .order-form form');
  412. // Validate
  413. var ValidateError = false;
  414. if(ShopOrderRequiredLastName && $.trim(OrderForm.find('input[name=client_last_name]').val()) == '') {
  415. OrderForm.find('input[name=client_last_name]').parent().parent().find('.input-error-msg').css('display', 'inline');
  416. if(!ValidateError) {
  417. setTimeout(function() { OrderForm.find('input[name=client_last_name]').first().focus(); }, 200);
  418. }
  419. ValidateError = true;
  420. }
  421. if(ShopOrderRequiredFirstName && $.trim(OrderForm.find('input[name=client_first_name]').val()) == '') {
  422. OrderForm.find('input[name=client_first_name]').parent().parent().find('.input-error-msg').css('display', 'inline');
  423. if(!ValidateError) {
  424. setTimeout(function() { OrderForm.find('input[name=client_first_name]').first().focus(); }, 200);
  425. }
  426. ValidateError = true;
  427. }
  428. if(ShopOrderRequiredMiddleName && $.trim(OrderForm.find('input[name=client_middle_name]').val()) == '') {
  429. OrderForm.find('input[name=client_middle_name]').parent().parent().find('.input-error-msg').css('display', 'inline');
  430. if(!ValidateError) {
  431. setTimeout(function() { OrderForm.find('input[name=client_middle_name]').first().focus(); }, 200);
  432. }
  433. ValidateError = true;
  434. }
  435. if(ShopOrderRequiredMobilePhone && $.trim(OrderForm.find('input[name=client_phone]').val()) == '') {
  436. OrderForm.find('input[name=client_phone]').parent().parent().find('.input-error-msg').css('display', 'inline');
  437. if(!ValidateError) {
  438. setTimeout(function() { OrderForm.find('input[name=client_phone]').first().focus(); }, 200);
  439. }
  440. ValidateError = true;
  441. }
  442. if(ShopOrderRequiredEmailAddress && $.trim(OrderForm.find('input[name=client_email]').val()) == '') {
  443. OrderForm.find('input[name=client_email]').parent().parent().find('.input-error-msg').css('display', 'inline');
  444. if(!ValidateError) {
  445. setTimeout(function() { OrderForm.find('input[name=client_email]').first().focus(); }, 200);
  446. }
  447. ValidateError = true;
  448. }
  449. if(ShopOrderRequiredDelivery && $.trim(OrderForm.find('input[name=client_delivery_comment]').val()) == '') {
  450. OrderForm.find('input[name=client_delivery_comment]').parent().parent().find('.input-error-msg').css('display', 'inline');
  451. if(!ValidateError) {
  452. setTimeout(function() { OrderForm.find('input[name=client_delivery_comment]').first().focus(); }, 200);
  453. }
  454. ValidateError = true;
  455. }
  456. if(ShopOrderRequiredComment && $.trim(OrderForm.find('textarea[name=client_order_comment]').val()) == '') {
  457. OrderForm.find('textarea[name=client_order_comment]').parent().parent().find('.input-error-msg').css('display', 'inline');
  458. if(!ValidateError) {
  459. setTimeout(function() { OrderForm.find('textarea[name=client_order_comment]').first().focus(); }, 200);
  460. }
  461. ValidateError = true;
  462. }
  463. if(ValidateError) {
  464. return;
  465. }
  466. // Send form
  467. ShopBasketBlockObject(object);
  468. $.ajax({
  469. type: "POST",
  470. url: OrderForm.attr('action'),
  471. data: OrderForm.serialize()
  472. }).done(function(data) {
  473. try {
  474. jdata = JSON.parse(data);
  475. if(jdata.error === true) {
  476. ShowOrderFormErrorMessage(ShopOrderError, window[jdata.variable]);
  477. if(jdata.field) {
  478. setTimeout(function() { OrderForm.find('[name=' + jdata.field + ']').first().focus(); }, 200);
  479. OrderForm.find('[name=' + jdata.field + ']').parent().parent().find('.input-error-msg').css('display', 'inline');
  480. }
  481. } else {
  482. ShopBasketSetNavBtnProductsCount(0);
  483. OrderFormBlock.css('display', 'none');
  484. $('#sys-modal-shop-basket .modal-body .data').html(window[jdata.variable]);
  485. $('#sys-modal-shop-basket button.btn-order').prop('disabled', true);
  486. }
  487. } catch(e) {
  488. ShowOrderFormErrorMessage(ShopOrderError, e.message);
  489. }
  490. }).fail(function(xhr, status, error) {
  491. ShowOrderFormErrorMessage(ShopOrderError, error);
  492. }).always(function() {
  493. ShopBasketUnBlockObject(object);
  494. });
  495. }
  496. },
  497. };
  498. }(window, $);
  499. window.frontend = frontend;
  500. }(window, jQuery));