1// PAGE READY 2$( window ).on( "load", function() { 3 $("html").addClass("ready"); 4}); 5 6$(document).ready(function() { 7 // BACK TO TOP FUNCTION 8 $(window).on('scroll', function() { 9 if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) { 10 document.getElementById("backToTop").style.display = "block"; 11 } else { 12 document.getElementById("backToTop").style.display = "none"; 13 } 14 }); 15 16 // GET MEDIA WIDTH 17 windowsDetect($( window ).width()); 18 $(window).on('resize', function() { 19 windowsDetect($( window ).width()); 20 }); 21 22 23 // STICKY HEADER - HEADER 24 var elementTop = $('#header').offset().top; 25 var elementBottom = elementTop + $('#header').outerHeight(); 26 27 $(window).on('resize scroll', function() { 28 29 var viewportTop = $(window).scrollTop(); 30 31 if(viewportTop > elementBottom) { 32 $('#header').addClass('isStickyHeader'); 33 $('#wrapper').css('margin-top', (elementBottom)); 34 } 35 36 if($('#header').is('.isStickyHeader') && viewportTop < elementBottom){ 37 $('#wrapper').css('margin-top', ''); 38 $('#header').removeClass('isStickyHeader'); 39 // $(window).scrollTop(0); 40 }; 41 }); 42 43 44 // BURGER - MAIN MENU TOGGLE 45 $('#burger-mainmenu').click(function(){ 46 $('#navi-bar').toggleClass('is-active'); 47 $(this).toggleClass('is-active'); 48 $("#navi-bar .navbar").find('*').removeClass("is-active"); 49 50 if($('#burger-topbar').is(".is-active")){ 51 $('#burger-topbar').toggleClass('is-active'); 52 $('#header-top-navbar').toggleClass('is-active'); 53 } 54 }); 55 56 // BURGER - TOP BAR TOGGLE 57 $('#burger-topbar').click(function(){ 58 $('#header-top-navbar').toggleClass('is-active'); 59 $(this).toggleClass('is-active'); 60 61 if($('#burger-mainmenu').is(".is-active")){ 62 $('#burger-mainmenu').toggleClass('is-active'); 63 $('#navi-bar').toggleClass('is-active'); 64 $("#navi-bar .navbar").find('*').removeClass("is-active"); 65 } 66 }); 67 68 69 // LOGIN DROPDOWN 70 $("#myaccount .account-dropdown").click(function(){ 71 $('#myaccount .dropdown').toggleClass('is-active');; 72 }); 73 74 $("#currency .currency-dropdown").click(function(){ 75 $('#currency .dropdown').toggleClass('is-active');; 76 }); 77 78 $(document).on("click", function(event){ 79 if(!$(event.target).closest("#myaccount").length){ 80 $('#myaccount .dropdown').removeClass("is-active"); 81 } 82 if(!$(event.target).closest("#currency").length){ 83 $('#currency .dropdown').removeClass("is-active"); 84 } 85 }); 86 87 88 // NAVIGATION DROPDOWN - ONLY IN MOBILE 89 if($( window ).width() < 1025){ 90 $(".navbar-dropdown .navbar-item").click(function(event){ 91 if(!$(this).is(".sub-menu-dropdown")){ 92 location.href = ($(this)['0'].href); 93 } 94 }); 95 //manufacturer product page 96 $(".man_filt_head_gt_child").click(function(event){ 97 navActive($(this)); 98 event.preventDefault ? event.preventDefault() : event.returnValue = false; 99 event.stopPropagation(); 100 }); 101 $(".man_filt_head_gt_child li a").click(function(event){ 102 if(!$(this).is(".sub-menu-dropdown")){ 103 location.href = ($(this)['0'].href); 104 } 105 }); 106 function navActive(nav){ 107 if(nav.is(".is-active")){ 108 nav.removeClass("is-active"); 109 } 110 else { 111 nav.addClass("is-active"); 112 } 113 } 114 } 115 116 117 // HEADLINE ROTATOR 118 setInterval(function(){
119 if($('#headline-message').css("left") == ('-' + $('#headline-message').width() + "px")){ 120 $('#headline-message').removeClass("headline-moving"); 121 $('#headline-message').css("left","100%"); 122 } 123 else if($('#headline-message').hasClass('headline-moving') == false){ 124 $('#headline-message').addClass('headline-moving'); 125 $('#headline-message').css("left","-" + $('#headline-message').width() + "px"); 126 } 127 },1000); 128 129 130 // ----- CONTENT MANAGEMENT ----- 131 var show_sidebarLeft = false; 132 var show_sidebarRight = false; 133 $('#sidebar-left').children().each (function(){ 134 var tagName = $(this).prop("tagName"); 135 if( tagName !== "SCRIPT" && tagName !== "STYLE"){ 136 // console.log(tagName); 137 138 //display one sidebar only 139 show_sidebarLeft = true; 140 $('#sidebar-right').remove(); 141 return false; 142 } 143 }) 144 145 $('#sidebar-right').children().each (function(){ 146 var tagName = $(this).prop("tagName"); 147 if( tagName !== "SCRIPT" && tagName !== "STYLE"){ 148 // console.log(tagName); 149 150 //display one sidebar only 151 show_sidebarRight = true; 152 $('#sidebar-left').remove(); 153 return false; 154 } 155 }) 156 157 if(show_sidebarLeft != true){ 158 $('#sidebar-left').remove(); 159 } 160 if(show_sidebarRight != true){ 161 $('#sidebar-right').remove(); 162 } 163 164 if(show_sidebarLeft == true || show_sidebarRight == true){ 165 if( $( window ).width() >= 1025 ) { 166 $('#main-content').css('max-width', '80%'); 167 } 168 else { 169 $('#main-content').css('max-width', ''); 170 } 171 } 172 173 // Responsive changes 174 $(window).on('resize', function() { 175 if(show_sidebarLeft == true || show_sidebarRight == true){ 176 if( $( window ).width() >= 1025 ) { 177 $('#main-content').css('max-width', '80%'); 178 } 179 else { 180 $('#main-content').css('max-width', ''); 181 } 182 } 183 }); 184 // ----- END CONTENT MANAGEMENT ----- 185 186 187 // ----- ACCORDION ----- 188 var acc = document.getElementsByClassName("accordion"); 189 for (var acc_counts = 0; acc_counts < acc.length; acc_counts++) { 190 acc[acc_counts].addEventListener("click", function() { 191 this.parentElement.classList.toggle("is-active"); 192 event.preventDefault ? event.preventDefault() : event.returnValue = false; 193 event.stopPropagation(); 194 }); 195 } 196 // ----- END ACCORDION ----- 197 198 // ----- SLICK CAROUSEL ----- 199 $("#main-content #module-fmanufacturers .carousel").not('.slick-initialized').slick({ 200 dots: false, 201 lazyLoad: 'ondemand', 202 infinite: true, 203 slidesToShow: 4, 204 slidesToScroll: 1, 205 autoplay: true, 206 autoplaySpeed: 3000, 207 responsive: [ 208 { 209 breakpoint: 480, 210 settings: { 211 slidesToShow: 2, 212 } 213 } 214 ] 215 }); 216 217 bannerSettings(); // Instantiate banner 218 // ----- END SLICK CAROUSEL ----- 219 220 221 // COMBINE FROM COMMON.JS 222 /* Search */ 223 $('#btn-search').bind('click', function() { 224 url = $('base').attr('href') + 'index.php?route=product/search'; 225 var search = $('#header_search').val(); 226 if (search) { 227 url += '&search=' + encodeURIComponent(search); 228 } 229 location = url; 230 }); 231 232 $('#icon-search').bind('click', function() { 233 url = $('base').attr('href') + 'index.php?route=product/search'; 234 var search = $('#header_search').val(); 235 if (search) { 236 url += '&search=' + encodeURIComponent(search); 237 } 238 location = url; 239 }); 240 241 $('#modal-search-product input[id=\'modal_search\']').bind('keydown', function(e) { 242 if (e.keyCode == 13) { 243 url = $('base').attr('href') + 'index.php?route=product/search'; 244 var search = $('#header_search').val(); 245 if (search) { 246 url += '&search=' + encodeURIComponent(search); 247 } 248 location = url; 249 } 250 }); 251 252 $('#search-toggle input[id=\'header_search\']').bind('keydown', function(e) { 253 if (e.keyCode == 13) { 254 url = $('base').attr('href') + 'index.php?route=product/search'; 255 var search = $('#header_search').val(); 256 if (search) { 257 url += '&search=' + encodeURIComponent(search); 258 } 259 location = url; 260 } 261 }); 262 263 // GOOGLE TRANSLATE UI 264 $('#btn-gtranslate').on('click', function() { 265 if($('#app-google-translate').hasClass('is-active')) { 266 $('#app-google-translate').removeClass('is-active'); 267 } else { 268 $('#app-google-translate').addClass('is-active'); 269 } 270 }); 271 // END GOOGLE TRANSLATE UI 272}); 273 274function productslick(home,category,product){ 275 // ----- SLICK CAROUSEL ----- 276 $("#home #main-content .module-product .carousel").not('.slick-initialized').slick({ 277 dots: false, 278 lazyLoad: 'ondemand', 279 infinite: true, 280 slidesToShow: home, 281 slidesToScroll: 1, 282 responsive: [ 283 { 284 breakpoint: 480, 285 settings: { 286 slidesToShow: 2, 287 } 288 } 289 ] 290 }); 291 292 $("#product-category #main-content .module-product .carousel").not('.slick-initialized').slick({ 293 dots: false, 294 lazyLoad: 'ondemand', 295 infinite: true, 296 slidesToShow: category, 297 slidesToScroll: 1, 298 responsive: [ 299 { 300 breakpoint: 480, 301 settings: { 302 slidesToShow: 2, 303 } 304 } 305 ] 306 }); 307 308 $("#product-product #main-content .module-product .carousel").not('.slick-initialized').slick({ 309 dots: false, 310 lazyLoad: 'ondemand', 311 infinite: true, 312 slidesToShow: product, 313 slidesToScroll: 1, 314 responsive: [ 315 { 316 breakpoint: 480, 317 settings: { 318 slidesToShow: 2, 319 } 320 } 321 ] 322 }); 323 324 $("#product-bundle #main-content .module-product .carousel").not('.slick-initialized').slick({ 325 dots: false, 326 lazyLoad: 'ondemand', 327 infinite: true, 328 slidesToShow: product, 329 slidesToScroll: 1, 330 responsive: [ 331 { 332 breakpoint: 480, 333 settings: { 334 slidesToShow: 2, 335 } 336 } 337 ] 338 }); 339} 340// ----- END SLICK CAROUSEL ----- 341 342// HIDE POPUP 343function hidePopUp() { 344 $( "#myModal" ).css( "display", "none" ); 345 $( "#blackbg" ).css( "display", "none" ); 346} 347// END HIDE POPUP 348 349// BACK TO TOP FUNCTION 350function backToTop() { 351 window.scroll({ 352 top: 0, 353 left: 0, 354 behavior: 'smooth' 355 }); 356} 357// END BACK TO TOP FUNCTION 358 359// MULTITABS 360function multitabs(home,category,product,isfade = false){ 361 362 // $('.multitabs .tabs ul li').first().addClass('is-active'); 363 var activeTab = $('.multitabs .tabs ul li.is-active').data('tab'); 364 $('.multitabs .tab-content div[data-content="' + activeTab + '"]').addClass('is-active'); 365 $('#home .multitabs .tab-content div[data-content="' + activeTab + '"] .carousel').not('.slick-initialized').slick({ 366 dots: false, 367 lazyLoad: 'ondemand', 368 infinite: true, 369 slidesToShow: home, 370 slidesToScroll: 1, 371 responsive: [ 372 { 373 breakpoint: 480, 374 settings: { 375 slidesToShow: 2, 376 } 377 } 378 ] 379 }); 380 381 $('#product-category .multitabs .tab-content div[data-content="' + activeTab + '"] .carousel').not('.slick-initialized').slick({ 382 dots: false, 383 lazyLoad: 'ondemand', 384 infinite: true, 385 slidesToShow: category, 386 slidesToScroll: 1, 387 responsive: [ 388 { 389 breakpoint: 480, 390 settings: { 391 slidesToShow: 2, 392 } 393 } 394 ] 395 }); 396 397 $('#product-product .multitabs .tab-content div[data-content="' + activeTab + '"] .carousel').not('.slick-initialized').slick({ 398 dots: false, 399 lazyLoad: 'ondemand', 400 infinite: true, 401 slidesToShow: product, 402 slidesToScroll: 1, 403 responsive: [ 404 { 405 breakpoint: 480, 406 settings: { 407 slidesToShow: 2, 408 } 409 } 410 ] 411 }); 412 413 $('.multitabs .tabs ul li').on('click', function() { 414 var tab = $(this).data('tab'); 415 $('.multitabs .tabs ul li').removeClass('is-active'); 416 $(this).addClass('is-active'); 417 418 $('.multitabs .tab-content div').removeClass('is-active'); 419 $('.multitabs .tab-content div[data-content="' + tab + '"]').addClass('is-active'); 420 421 // CAROUSEL 422 $('#home .multitabs .tab-content div[data-content="' + tab + '"] .carousel').not('.slick-initialized').slick({ 423 dots: false, 424 lazyLoad: 'ondemand', 425 infinite: true, 426 slidesToShow: home, 427 slidesToScroll: 1, 428 responsive: [ 429 { 430 breakpoint: 480, 431 settings: { 432 slidesToShow: 2 433 } 434 } 435 ] 436 }); 437 438 $('#product-category .multitabs .tab-content div[data-content="' + tab + '"] .carousel').not('.slick-initialized').slick({ 439 dots: false, 440 lazyLoad: 'ondemand', 441 infinite: true, 442 slidesToShow: category, 443 slidesToScroll: 1, 444 responsive: [ 445 { 446 breakpoint: 480, 447 settings: { 448 slidesToShow: 2, 449 } 450 } 451 ] 452 }); 453 454 $('#product-product .multitabs .tab-content div[data-content="' + tab + '"] .carousel').not('.slick-initialized').slick({ 455 dots: false, 456 lazyLoad: 'ondemand', 457 infinite: true, 458 slidesToShow: product, 459 slidesToScroll: 1, 460 responsive: [ 461 { 462 breakpoint: 480, 463 settings: { 464 slidesToShow: 2, 465 } 466 } 467 ] 468 }); 469 470 if(isfade){ 471 productfade(); 472 } 473 }); 474} 475 476// END MULTITABS 477 478// ----- SLICK CAROUSEL - MODULE SETTINGS ----- 479 // BANNER MODULE 480 function bannerSettings(){ 481 $("#module-banner .carousel").not('.slick-initialized').slick({ 482 dots: false, 483 infinite: true, 484 slidesToShow: 1, 485 slidesToScroll: 1, 486 fade: true, 487 autoplay: true, 488 autoplaySpeed: 2000,
489 cssEase: 'linear' 490 }); 491 } 492// ----- END SLICK CAROUSEL - MODULE SETTINGS ----- 493 494 495// ----- MODAL ----- 496 var rootEl = document.documentElement; 497 var $modals = getAll('.modal'); 498 var $modalButtons = getAll('.modal-button'); 499 var $modalCloses = getAll('.modal-background, .modal-close, .modal-card-head .delete, .modal-card-foot .button'); 500 501 if ($modalButtons.length > 0) { 502 $modalButtons.forEach(function ($el) { 503 $el.addEventListener('click', function () { 504 var target = $el.dataset.target; 505 openModal(target); 506 }); 507 }); 508 } 509 510 if ($modalCloses.length > 0) { 511 $modalCloses.forEach(function ($el) { 512 $el.addEventListener('click', function () { 513 closeModals(); 514 }); 515 }); 516 } 517 518 function openModal(target) { 519 var $target = document.getElementById(target); 520 rootEl.classList.add('is-clipped'); 521 $target.classList.add('is-active'); 522 } 523 524 function closeModals() { 525 rootEl.classList.remove('is-clipped'); 526 $modals.forEach(function ($el) { 527 $el.classList.remove('is-active'); 528 }); 529 } 530 531 document.addEventListener('keydown', function (event) { 532 var e = event || window.event; 533 if (e.keyCode === 27) { 534 closeModals(); 535 closeDropdowns(); 536 } 537 }); 538 539 function getAll(selector) { 540 return Array.prototype.slice.call(document.querySelectorAll(selector), 0); 541 } 542// ----- END MODAL ----- 543 544// ----- PRODUCT IMAGE HOVER ----- 545 function hoverchange(particular_id){ 546 // $("."+particular_id).animate({opacity:.8},250); 547 $("."+particular_id).attr("src", $("."+particular_id).attr("over")); 548 // $("."+particular_id).animate({opacity:1},100); 549 } 550 551 function outchange(particular_id){ 552 // $("."+particular_id).animate({opacity:.8},250); 553 $("."+particular_id).attr("src", $("."+particular_id).attr("out")); 554 // $("."+particular_id).animate({opacity:1},100); 555 } 556// ----- END PRODUCT IMAGE HOVER ----- 557 558// ----- SEARCH AUTO COMPLETE ----- 559 function search_autocomplete() { 560 $('input[name=\'search\']').autocomplete({ 561 minLength: 3, //min enter 3 char 562 maxResults: 5, //only max 5 result 563 delay: 500, 564 source: function(request, response) { 565 $.ajax({ 566 //go to load auto complete function 567 url: 'index.php?route=common/header/autocomplete&search=' + encodeURIComponent(request.term), 568 //data pass by json 569 dataType: 'json', 570 //if success 571 success: function(json) { 572 response($.map(json, function(item) { 573 return { 574 //return item name 575 label: item.name, 576 //return product id 577 value: item.product_id 578 } 579 })); 580 } 581 }); 582 }, 583 select: function(event, ui) { 584 $('input[name=\'search\']').val(ui.item.label); 585 $('#header_search').val(ui.item.label); 586 if($('#header').hasClass('uni-head-4') || $('#header').hasClass('uni-head-5')){ 587 if($('.body-style').hasClass('desktop')){ 588 search(); 589 } else { 590 $('#button-search').trigger('click'); 591 } 592 } else { 593 $('#button-search').trigger('click'); 594 } 595 return false; 596 }, 597 focus: function(event, ui) { 598 return false; 599 } 600 }); 601 } 602// ----- END SEARCH AUTO COMPLETE ----- 603 604// ----- MEDIA WIDTH CONTROLLER ----- 605 function windowsDetect($windowWidth){ 606 607 var className; 608 $('body').removeClass('desktop'); 609 $('body').removeClass('tablet'); 610 $('body').removeClass('mobile'); 611 612 // DESKTOP 613 if( $windowWidth >= 1025 ) { 614 className = "desktop"; 615 } 616 617 // TABLET 618 if ( 1024 >= $windowWidth && $windowWidth >= 479 ){ 619 className = "tablet"; 620 } 621 622 // MOBILE 623 if ( $windowWidth <= 480 ){ 624 className = "mobile"; 625 } 626 627 $('body').addClass(className); 628 } 629// ----- END MEDIA WIDTH CONTROLLER----- 630 631// ----- PRODUCT VIEW SWITCH ----- 632 function display(view) { 633 if (view == 'grid') { 634 $('.grid-view').addClass('active'); 635 $('.list-view').removeClass('active'); 636 $('.module-product.product-listing').removeClass('list-view'); 637 $.totalStorage('display', 'grid'); 638 } else { 639 $('.grid-view').removeClass('active'); 640 $('.list-view').addClass('active'); 641 $('.module-product.product-listing').addClass('list-view'); 642 $.totalStorage('display', 'list'); 643 } 644 } 645 646 view = $.totalStorage('display'); 647 648 if (view) { 649 display(view); 650 } else { 651 display('grid'); 652 } 653// ----- END PRODUCT VIEW SWITCH ----- 654 655// ----- PRODUCT EFFECT FADE ----- 656 function productfade() { 657 $(document).ready(function() { 658 $('.module-product .box-content > div, .module-product .carousel .slick-slide, .tab-product .box-content > div, .tab-product .carousel .slick-slide').each(function(index) { 659 $(this).bind('mouseenter',function(){ 660 $(this).siblings().stop(); 661 $(this).siblings().animate({opacity:.6},500); 662 663 }); 664 665 $(this).bind('mouseleave',function(){ 666 $(this).siblings().stop(); 667 $(this).siblings().animate({opacity:1},500); 668 669 }); 670 671 }); 672 }); 673 } 674// ----- END PRODUCT EFFECT FADE ----- 675 676 677// POPUP MODAL 678function info(id){ 679 document.getElementById('modal-information-info').classList.add('is-active'); 680 $.ajax({ 681 url: 'index.php?route=information/information/info&information_id='
681+id, 682 dataType: 'json', 683 beforeSend: function(){ 684 $('.loading').show(); 685 $('#modal-information-info .modal-card-body .information-description').remove(); 686 }, 687 complete: function(){ 688 $('.loading').hide(); 689 }, 690 success: function(json) { 691 $('#modal-information-info .modal-card .logo').html('<img src="'+json['logo']+'" title="'+json['name']+'" alt="'+json['name']+'">'); 692 $('#modal-information-info .modal-card .modal-card-title').html(json['title']); 693 $('#modal-information-info .modal-card-body .loading').after('<div class="information-description">'+json['html']+'</div>'); 694 } 695 }); 696} 697 698function subscribe(){ 699 document.getElementById('modal-subscribe').classList.add('is-active'); 700} 701 702function payMethod(){ 703 document.getElementById('modal-payment-method').classList.add('is-active'); 704} 705 706function uploadBankTransfer(order_id){ 707 document.getElementById('modal-bank-transfer').classList.add('is-active'); 708 $('#modal-bank-transfer .modal-card-body .bank-transfer-info').load('index.php?route=notification/notification/upload&order_id='+order_id); 709} 710 711function rateReview(order_id,product_id,order_product_id){ 712 document.getElementById('modal-rate-review').classList.add('is-active'); 713 $('#modal-rate-review .modal-card-body .rate-review-info').load('index.php?route=account/order/review&order_id='+order_id+'&product_id='+product_id+'&order_product_id='+order_product_id); 714} 715 716function returnProduct(order_id,product_id){ 717 document.getElementById('modal-return-product').classList.add('is-active'); 718 $('#modal-return-product .modal-card-body .return-product-info').load('index.php?route=account/return/insertNew&order_id='+order_id+'&product_id='+product_id); 719} 720 721function downloadEbook(order_id,order_product_id){ 722 document.getElementById('modal-download').classList.add('is-active'); 723 $('#modal-download .modal-card-body .download-info').load('index.php?route=account/download/getDownloadlist&order_id='+order_id+'&order_product_id='+order_product_id); 724} 725// END POPUP MODAL 726 727// COMBINED FROM COMMON.JS 728function getURLVar(key) { 729 var value = []; 730 var query = String(document.location).split('?'); 731 if (query[1]) { 732 var part = query[1].split('&'); 733 734 for (i = 0; i < part.length; i++) { 735 var data = part[i].split('='); 736 737 if (data[0] && data[1]) { 738 value[data[0]] = data[1]; 739 } 740 } 741 742 if (value[key]) { 743 return value[key]; 744 } else { 745 return ''; 746 } 747 } 748} 749 750 751function addToCart(product_id, quantity) { 752 753 quantity = typeof(quantity) != 'undefined' ? quantity : 1; 754 755 if($('#config_cart_modal').val()==1){ 756 $.ajax({ 757 url: 'index.php?route=checkout/cart/add', 758 type: 'post', 759 data: 'product_id=' + product_id + '&quantity=' + quantity, 760 dataType: 'json', 761 beforeSend: function(){ 762 //$('.let_it_appear').append('<div id="add_to_cart" style="vertical-align: middle;"></div>'); 763 }, 764 success: function(json) { 765 $('#current_product_id').val(product_id); 766 //console.log(json); 767 if (json['redirect']) { 768 location = json['redirect']; 769 }else{ 770 if(json['total'] > 999){ 771 $('#shopping-cart > .count-frame').html('<span class="shopping-cart-count max">999+</span>'); 772 } else { 773 $('#shopping-cart > .count-frame').html('<span class="shopping-cart-count">'+json['total']+'</span>'); 774 } 775 $('#checkout-cart').html('<span class="cart-info">'+json['total2']+'</span><i class="mdi mdi-cart"></i>'); 776 if($('#you_might_need_this_status').val()==1){ 777 //temporary hide 778 $('#black_background').show(); 779 $('#modal-checkout-cartmodal').show(); 780 $('#close_button2').show(); 781 $('#modal-checkout-cartmodal').html('<img style="position: absolute; left: 0; right: 0; margin: auto; top: 0; bottom: 0;" src="https://i.stack.imgur.com/FhHRx.gif" />'); 782 setTimeout(function(){ $('#modal-checkout-cartmodal').html(json['html']); }, 500); 783 } else { 784 $('div[id="checkout-cart"]').click(); 785 } 786 } 787 } 788 }); 789 }else{ 790 $.ajax({ 791 url: 'index.php?route=checkout/cart/add', 792 type: 'post', 793 data: 'product_id=' + product_id + '&quantity=' + quantity, 794 dataType: 'json', 795 success: function(json) { 796 $('.success, .warning, .attention, .information, .error').remove(); 797 798 if (json['redirect']) { 799 location = json['redirect']; 800 } 801 802 if (json['success']) { 803 swal({ 804 html: json['success'], 805 type: "success", 806 showConfirmButton : false, 807 timer: 1500 808 }) 809 810 if(json['total'] > 999){ 811 $('#shopping-cart > .count-frame').html('<span class="shopping-cart-count max">999+</span>'); 812 } else { 813 $('#shopping-cart > .count-frame').html('<span class="shopping-cart-count">'+json['total']+'</span>'); 814 } 815 $('#checkout-cart').html('<span class="cart-info">'+json['total2']+'</span><i class="mdi mdi-cart"></i>'); 816 817 } 818 } 819 }); 820 } 821} 822function addToWishList(product_id) { 823 $.ajax({ 824 url: 'index.php?route=account/wishlist/add', 825 type: 'post', 826 data: 'product_id=' + product_id, 827 dataType: 'json', 828 success: function(json) { 829 $('.success, .warning, .attention, .information').remove(); 830 831 if (json['success']) { 832 swal({ 833 html: json['success'], 834 type: "success", 835 showConfirmButton : true, 836 confirmButtonText: json['aio_text_go_to_my_wishlist'], 837 showCancelButton: true, 838 cancelButtonText: json['aio_text_back'], 839 }).then(function(result) { 840 if (result.value) { 841 window.location = json['link_to_my_wishlist']; 842 } 843 }); 844 845 $('#wishlist-total').html(json['total']); 846 847 } 848 } 849 }); 850} 851 852function addToCompare(product_id) { 853 $.ajax({ 854 url: 'index.php?route=product/compare/add', 855 type: 'post', 856 data: 'product_id=' + product_id, 857 dataType: 'json', 858 success: function(json) { 859 $('.success, .warning, .attention, .information').remove(); 860 861 if (json['success']) { 862 swal({ 863 html: json['success'], 864 type: "success", 865 showConfirmButton : true, 866 confirmButtonText: json['aio_text_go_to_my_compare'], 867 showCancelButton: true, 868 cancelButtonText: json['aio_text_back'], 869 }).then(function(result) { 870 if (result.value) { 871 window.location = json['link_to_my_compare']; 872 } 873 }); 874 875 876 $('.success').fadeIn('slow'); 877 878 $('#compare-total').html(json['total']); 879 880 } 881 } 882 }); 883} 884 885
886function applyCode(data){ 887 if(data==1){ 888 var value = $('#apply_coupon').val(); 889 var next = 'coupon'; 890 }else if(data==2){ 891 var value = $('#apply_voucher').val(); 892 var next = 'voucher'; 893 }else if(data==3){ 894 var value = $('#apply_reward').val(); 895 var next = 'reward'; 896 } 897 $.ajax({ 898 url: 'index.php?route=checkout/cart/applyCode', 899 type: 'post', 900 data: next + '=' + value + '&next=' + next + '&product_id=' +encodeURIComponent($('#current_product_id').val()), 901 dataType: 'json', 902 success: function(json) { 903 $('#modal-checkout-cartmodal').html(''); 904 console.log(json['html']); 905 $('#modal-checkout-cartmodal').html(json['html']); 906 907 $('#modal-checkout-cartmodal').scrollTop(0); 908 } 909 }); 910} 911 912function applyShipping(){ 913 $.ajax({ 914 url: 'index.php?route=checkout/cart/applyShipping', 915 type: 'post', 916 data: 'shipping_method='+ $('input[name=shipping_method]:checked').val() +'&product_id=' +encodeURIComponent($('#current_product_id').val()), 917 dataType: 'json', 918 success: function(json) { 919 $('#modal-checkout-cartmodal').html(json['html']); 920 $('#cboxOverlay').hide(); 921 $('#colorbox').hide();
922 $('#modal-checkout-cartmodal').scrollTop(0); 923 } 924 }); 925} 926 927function submitSubscribe(){ 928 $('#subscribe-form').submit(); 929} 930 931/* Ajax Cart */ 932// $('div[id="shopping-cart"]').on('mouseenter', function() { 933$('div[id="checkout-cart"]').click(function(){ 934 $('.checkout-overlay').addClass('is-active'); 935 $('#header .container #myaccount').css('z-index','32'); 936 $('#header .container #currency').attr('style','z-index:32 !important'); 937 // $('.shopping-cart-frame').load('index.php?route=module/cart .shopping-cart-frame > *'); 938 updateCart(); 939 $('#fb-root .fb_iframe_widget iframe').addClass('is-hidden'); 940 $('#fb-root .fb_dialog').addClass('is-hidden'); 941}); 942$('.checkout-overlay').click(function() { 943 $('.checkout-overlay').removeClass('is-active'); 944 $('#header .container #myaccount').css('z-index',''); 945 $('#header .container #currency').css('z-index',''); 946 $('#fb-root .fb_iframe_widget iframe').removeClass('is-hidden'); 947 $('#fb-root .fb_dialog').removeClass('is-hidden'); 948}); 949// $('#btn-close-cart').click(function() { 950function closeSide(){ 951 $('.checkout-overlay').removeClass('is-active'); 952 $('#header .container #myaccount').css('z-index',''); 953 $('#header .container #currency').css('z-index',''); 954 $('#fb-root .fb_iframe_widget iframe').removeClass('is-hidden'); 955 $('#fb-root .fb_dialog').removeClass('is-hidden'); 956} 957 958function updateCart(){ 959 $.ajax({ 960 type: 'get', 961 url: 'index.php?route=module/cart', 962 dataType: 'html', 963 cache: false, 964 success: function(html) { 965 var content = $(html).find('.shopping-cart-frame > *'); 966 $('.shopping-cart-frame').html(content); 967 }, 968 error: function (error) { 969 $('.shopping-cart-frame').html('Unable to load cart'); 970 } 971 }); 972} 973 974function removeProduct(key){ 975 $('#shopping-cart > #checkout-cart').load('index.php?route=module/cart&remove=' + key + ' #shopping-cart #checkout-cart > *'); 976 $('#shopping-cart > .count-frame').load('index.php?route=module/cart&remove=' + key + ' #shopping-cart .count-frame > *'); 977 updateCart(); 978} 979// END COMBINED FROM COMMON.JS 980 981 982// SEARCH 983function search(){ 984 if($('#header').hasClass('uni-head-4') || $('#header').hasClass('uni-head-5')){ 985 if($('.body-style').hasClass('desktop')){ 986 url = $('base').attr('href') + 'index.php?route=product/search'; 987 988 var search = $('#header_search').val(); 989 990 if (search) { 991 url += '&search=' + encodeURIComponent(search); 992 } 993 994 location = url; 995 } else { 996 document.getElementById('modal-search-product').classList.add('is-active'); 997 $('input[name=\'search\']').focus(); 998 } 999 } else { 1000 document.getElementById('modal-search-product').classList.add('is-active'); 1001 $('input[name=\'search\']').focus(); 1002 } 1003} 1004// END SEARCH 1005 1006// BOOKING FUNCTION 1007function booking(){ 1008 $('.shopping-cart-frame').addClass('display'); 1009} 1010function goBacktoCart(){ 1011 $('.shopping-cart-frame').removeClass('display'); 1012} 1013 1014var setDeliveryDate; 1015 1016function startSubmitOTS() { 1017 setDeliveryDate = setTimeout(function() { 1018 ajaxSubmitDeliveryDate(); 1019 }, 500); 1020} 1021 1022function stopSubmitOTS() { 1023 clearTimeout(setDeliveryDate); 1024} 1025 1026function ajaxSubmitDeliveryDate(){ 1027 var title = $('input[name=\'delivery_time\']:checked').attr('data-title'); 1028 var time = $('input[name=\'delivery_time\']:checked').val(); 1029 var date = $('#delivery-date').val(); 1030 var comment = $('#order-time-slot-comment').val() 1031 $.ajax({ 1032 url: 'index.php?route=module/order_time_slot/setSelectedDateTime', 1033 type: 'post', 1034 data: { date : date , title : title , time : time , comment : comment }, 1035 dataType: 'json', 1036 success: function(json) { 1037 // console.log(json); 1038 } 1039 }); 1040} 1041 1042// $(".delivery-time-list").delegate("input[name='delivery_time']", "click", function(){ 1043// startSubmitOTS(); 1044// }); 1045function comment(){ 1046 //$('textarea[name="order_time_slot_comment"]').on('input', function() { 1047 stopSubmitOTS(); 1048 startSubmitOTS(); 1049//}); 1050} 1051// END BOOKING 1052 1053//JAVASCRIPT FOR NOT DISPLAY OTHER THAN UL LI IN PRODUCT HIGHTLIGHT// 1054$( "#product-special .product-highlight, #product-category .product-highlight, #product-collections .product-highlight, #product-manufacturer-info .product-highlight, #product-price-sort .product-highlight, #product-search .product-highlight, #product-wholesale .product-highlight" ).find('*').not( "li,ul,li span,li p,li strong,li font,li b" ).css( "display", "none" );
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.