themes/BootstrapTheme/SyliusShopBundle/views/_scripts.html.twig line 1

Open in your IDE?
  1. <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
  2. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" charset="UTF-8"></script>
  3. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.js" charset="UTF-8"></script>
  4. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/components/dimmer.min.js" charset="UTF-8"></script>
  5. <script src="https://cdnjs.cloudflare.com/ajax/libs/wow/1.1.2/wow.min.js" integrity="sha512-Eak/29OTpb36LLo2r47IpVzPBLXnAMPAVypbSZiZ4Qkf8p/7S/XRG5xp7OKWPPYfJT6metI+IORkR5G8F900+g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  6. <script src="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.js" integrity="sha512-Yk47FuYNtuINE1w+t/KT4BQ7JaycTCcrvlSvdK/jry6Kcxqg5vN7/svVWCxZykVzzJHaxXk5T9jnFemZHSYgnw==" crossorigin="anonymous"></script>
  7. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css" integrity="sha512-6qkvBbDyl5TDJtNJiC8foyEVuB6gxMBkrKy67XpqnIDxyvLLPJzmTjAj1dRJfNdmXWqD10VbJoeN4pOQqDwvRA==" crossorigin="anonymous" />
  8. <script src="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.min.js"></script>
  9. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-expander/1.7.0/jquery.expander.min.js" integrity="sha512-owmUWt/accgjJVsM8cWGa/n2qT77yC2+dJ8BDmGOQSKQ42DApWgpjINbUhWQ9CTTpdlTJa6OJEycyuaSzBN6lw==" crossorigin="anonymous"></script>
  10. <link href="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.css" rel="stylesheet">
  11. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-zoom/1.7.21/jquery.zoom.min.js" integrity="sha512-m5kAjE5cCBN5pwlVFi4ABsZgnLuKPEx0fOnzaH5v64Zi3wKnhesNUYq4yKmHQyTa3gmkR6YeSKW1S+siMvgWtQ==" crossorigin="anonymous"></script>
  12. <script src="https://cdn.jsdelivr.net/npm/jquery-multifile@2.2.2/jquery.MultiFile.min.js" type="text/javascript" language="javascript"></script>
  13. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
  14. <script>
  15.     $(document).on('click', '[data-toggle="lightbox"]', function(event) {
  16.         event.preventDefault();
  17.         $(this).ekkoLightbox({ wrapping: false });
  18.     });
  19.     $('.scrollPerso').mCustomScrollbar({
  20.         theme:"dark"
  21.     })
  22.     $('.expand-me').expander({
  23.         slicePoint: 150,
  24.         expandEffect: 'slideDown',
  25.         expandText: '<a href="#" class="text-underline color-bleu" title=""> + {{"app.taxon.lire_lasuite" |trans}}</a>',
  26.         userCollapseText: '<a href="#" class="text-underline color-bleu" title=""> - {{"app.taxon.reduire" |trans}}</a>'
  27.     });
  28.     function initZoomable(selector) {
  29.         if (selector) {
  30.             var $elt = $(selector), option = {url: $elt.attr('href')};
  31.             $(selector).on('click', function (e) {
  32.                 e.preventDefault();
  33.             }).trigger('zoom.destroy').zoom(option);
  34.         }
  35.     }
  36.     function changeImg(srcImg,srcImg2){
  37.         document.getElementById('big').src = srcImg ;
  38.         document.getElementById('bigLink').href = srcImg2;
  39.         document.getElementsByClassName('zoomImg')[0].href=srcImg2;
  40.         initZoomable('.zoomable');
  41.     }
  42.     $("#bigLink").on('click', function (e) {
  43.         e.preventDefault();
  44.     });
  45.     $('#bigLink').zoom();
  46. </script>
  47. {# gestion de la partie configurateur #}
  48. <script>
  49.     //import SyliusVariantImages from '/../../assets/js/sylius-variant-images';
  50.     $( document ).ready(function() {
  51.         var checkboxOptionPerforatedBottom =  $('#add_specific_product_to_cart_perforated_bottom_option');
  52.         var optionPerforatedBottom =  $('#option_perforated_bottom');
  53.         var howManyPerforatedBottom =  $('#add_specific_product_to_cart_how_many_perforated_bottom');
  54.         var priceTotal = 0;
  55.         var priceTotalWithoutPromo = 0;
  56.         var productConfigurable = 0;
  57.         var typeCategories = ['depart', 'suivant'];
  58.         $('.pb-2').find('.app_product_vaiant').each(function() {
  59.             let price = $(this)
  60.                 .find("#price")
  61.                 .attr("data-price");
  62.             let priceWithoutPromo = $(this)
  63.                 .find("#price")
  64.                 .attr("data-original-value");
  65.             let quantity = $(this.parentNode)
  66.                 .find("input[type=number]")
  67.                 .val();
  68.             if (quantity != null && price != null) {
  69.                 priceTotal = priceTotal + (parseInt(quantity) * parseInt(price));
  70.                 if(priceWithoutPromo !== ""){
  71.                     priceTotalWithoutPromo = priceTotalWithoutPromo + (parseInt(quantity) * parseInt(priceWithoutPromo));
  72.                 }else{
  73.                     priceTotalWithoutPromo = priceTotalWithoutPromo + (parseInt(quantity) * parseInt(price));
  74.                 }
  75.             }
  76.             productConfigurable = 1
  77.         });
  78.         if(productConfigurable === 1){
  79.           $('.btn-add-panier').attr("disabled", "disabled");
  80.             let priceEuros = ((priceTotal/100));
  81.             let priceEurosWithoutPromo = ((priceTotalWithoutPromo/100));
  82.             let displayPrice = new Intl.NumberFormat('fr-FR', {
  83.                 style: 'currency',
  84.                 currency: 'EUR'
  85.             });
  86.             $("#product-price").text(displayPrice.format(priceEuros));
  87.             $("#product-price-without-promo").text(displayPrice.format(priceEurosWithoutPromo));
  88.             buildImageVariant();
  89.         }
  90.         // $('input[type=number]:not(.free-option)').change(function(){
  91.         //     let cart = document.querySelector('.prix-art-panier');
  92.         //     var priceTotal = 0;
  93.         //     var priceTotalWithoutPromo = 0;
  94.         //     let hasQuantity = 0;
  95.         //     $('.pb-2.tr-visible').find('.app_product_vaiant').each(function() {
  96.         //         let price = $(this)
  97.         //             .find("#price")
  98.         //             .attr("data-price");
  99.         //
  100.         //         let priceWithoutPromo = $(this)
  101.         //             .find("#price")
  102.         //             .attr("data-original-value");
  103.         //
  104.         //         let quantity = $(this.parentNode)
  105.         //             .find("input[type=number]:not(.free-option)")
  106.         //             .val();
  107.         //         hasQuantity+=parseInt(quantity);
  108.         //         if (quantity != null && price != null) {
  109.         //             priceTotal = priceTotal + (parseInt(quantity) * parseInt(price));
  110.         //             if(priceWithoutPromo !== ""){
  111.         //                 priceTotalWithoutPromo = priceTotalWithoutPromo + (parseInt(quantity) * parseInt(priceWithoutPromo));
  112.         //             }else{
  113.         //                 priceTotalWithoutPromo = priceTotalWithoutPromo + (parseInt(quantity) * parseInt(price));
  114.         //             }
  115.         //         }
  116.         //
  117.         //     });
  118.         //     if(hasQuantity === 0){
  119.         //         $('.btn-add-panier').attr("disabled", "disabled");
  120.         //     }else{
  121.         //         $('.btn-add-panier').removeAttr("disabled");
  122.         //     }
  123.         //     let priceEuros = ((priceTotal/100));
  124.         //     let priceEurosWithoutPromo = ((priceTotalWithoutPromo/100));
  125.         //     let displayPrice = new Intl.NumberFormat('fr-FR', {
  126.         //         style: 'currency',
  127.         //         currency: 'EUR'
  128.         //     });
  129.         //     $("#product-price").text(displayPrice.format(priceEuros));
  130.         //     $("#product-price-without-promo").text(displayPrice.format(priceEurosWithoutPromo));
  131.         // });
  132.         var $selects = $('.filtreOptions');
  133.         typeCategories.forEach(function(category, index){
  134.             let filterableRows = $('.sylius-product-variants').find('tr.' + category);
  135.            filterableRows.parent().parent().parent().hide().filter(function() {
  136.                 return $(this).find('td').not('.quantity').not("#price").not(".stock").filter(function() {
  137.                     let tdText = $(this).attr('data-value-code');
  138.                     let selectValue = $('#filtreOptions_' + $(this).data('input')+'_'+category).val();
  139.                     return tdText === selectValue;
  140.                 }).length === $(this).find('td').not('.quantity').not("#price").not(".stock").length;
  141.             }).show().addClass("tr-visible");
  142.         });
  143.         $selects.on('change', function() {
  144.             $('input[type=number]:not(.free-option)').each(function() {
  145.                     $(this).val("0");
  146.                     $(this).trigger("change");
  147.                 }
  148.             );
  149.             typeCategories.forEach(function(category, index) {
  150.                 let filterableRows = $('.sylius-product-variants').find('tr.' + category);
  151.                 filterableRows.parent().parent().parent().hide().removeClass("tr-visible").filter(function () {
  152.                         return $(this).find('td').not('.quantity').not("#price").not(".stock").filter(function () {
  153.                                 let tdText = $(this).attr('data-value-code'),
  154.                                     selectValue = $('#filtreOptions_' + $(this).data('input')+'_'+category).val();
  155.                             return tdText === selectValue;
  156.                             }).length === $(this).find('td').not('.quantity').not("#price").not(".stock").length;
  157.                     }).show().addClass("tr-visible");
  158.             });
  159.             buildImageVariant();
  160.         });
  161.         if(!checkboxOptionPerforatedBottom.checked){
  162.             optionPerforatedBottom.hide();
  163.             howManyPerforatedBottom.val(0);
  164.         }else{
  165.             optionPerforatedBottom.show();
  166.         }
  167.         checkboxOptionPerforatedBottom.change(function(){
  168.             if(this.checked){
  169.                 optionPerforatedBottom.show();
  170.             } else {
  171.                 optionPerforatedBottom.hide();
  172.                 howManyPerforatedBottom.val(0);
  173.             }
  174.         });
  175.         //new SyliusVariantImagesTest();
  176.         buildImageVariant();
  177.         function buildImageVariant(){
  178.             let mainImageLink = document.querySelector('[data-product-image]');
  179.             let variantPath ="";
  180.             let triggers;
  181.             if(productConfigurable === 1){
  182.                 triggers = document.querySelectorAll('.trigger-variant-image.depart');
  183.             }else{
  184.                 triggers = document.querySelectorAll('.table-devis .form-control');
  185.             }
  186.             //let variantsDiv = document.querySelectorAll('.sylius-image-variants');
  187.             let triggersArray = Array.prototype.slice.call(triggers, 0);
  188.             for (var i = 0; i < triggersArray.length; i++) {
  189.                 var element = triggersArray[i];
  190.                 //let elementWithoutSpace = element.value.replace(/\s/g, "");
  191.                 variantPath+=element.value;
  192.             }
  193.             //var imageObjects = document.querySelectorAll('.img-bit-article a img');
  194.             //var imageVariants = document.querySelectorAll('.sylius-image-variants');
  195.             var imageVariants = $('.sylius-image-variants').find('div[data-variant-options = "'+ variantPath +'"]');
  196.             //var imageVariantsToNotDisplay = $('div[data-variant-options]').not('div[data-variant-options="' + variantPath + '"]');
  197.             imageVariants.each(function(index, element){
  198.                 let imagePath = $(element).attr("data-variant-image-path");
  199.                 mainImageLink.setAttribute('src',imagePath);
  200.                 mainImageLink.setAttribute('data-product-image',imagePath);
  201.                 mainImageLink.setAttribute('data-product-link',imagePath);
  202.                 $(mainImageLink).find('a').each(function(index, element){
  203.                     $(element).css('display', 'block');
  204.                     $(element).attr("href", imagePath);
  205.                     $(element).find('img').each(function(index, img){
  206.                         $(img).attr('src', imagePath);
  207.                     })
  208.                 });
  209.             });
  210.             let swipper_images = $('.supp-img').find('.sylius-image-variants');
  211.             swipper_images.each(function (index, element){
  212.                 let data_variants = $(element).find('div[data-variant-image-path]');
  213.                 // if(data_variants.length === 0){
  214.                 //     $(element.parentNode).css('display', 'none');    // POUR CACHER LES IMAGES QUI N ONT PAS DE VARIANTS
  215.                 // }
  216.                 data_variants.each(function(indexVariant, imageVariant){
  217.                     let imagePath = $(imageVariant).attr("data-variant-image-path");
  218.                     if(imagePath !== mainImageLink.getAttribute('src') ){
  219.                         // $(element.parentNode).css('display', 'none');
  220.                         // $(element.parentNode).css('background-color', 'red');
  221.                     }else{
  222.                         $(element.parentNode).css('display', 'block');
  223.                     }
  224.                 })
  225.             });
  226.         }
  227.     });
  228. </script>
  229. {{ encore_entry_script_tags('app', null, 'bootstrapTheme') }}