PageSourceSearch

https://montessoriparatodos.es/modules/ets_crosssell/views/js/front.js

js montessoriparatodos.es collected 2026-10-03 23:14:58 UTC 21,954 bytes, 486 lines download raw bytes

1/**
2 * 2007-2020 ETS-Soft
3 *
4 * NOTICE OF LICENSE
5 *
6 * This file is not open source! Each license that you purchased is only available for 1 wesite only.
7 * If you want to use this file on more websites (or projects), you need to purchase additional licenses. 
8 * You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
9 * 
10 * DISCLAIMER
11 *
12 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
13 * versions in the future. If you wish to customize PrestaShop for your
14 * needs please contact us for extra customization service at an affordable price
15 *
16 *  @author ETS-Soft <[email protected]>
17 *  @copyright  2007-2020 ETS-Soft
18 *  @license    Valid for 1 website (or project) for each purchase of license
19 *  International Registered Trademark & Property of ETS-Soft
20 */
21
22$(document).ready(function(){ 
23    
24    $('.featured-products.products-grid article').each(function(){
25        $(this).find('.product-thumbnail img:last-child').attr("src",$(this).find('.product-thumbnail img:last-child').attr("data-src"));
26        $(this).find('.product-thumbnail img:first-child').attr("src",$(this).find('.product-thumbnail img:first-child').attr("data-src"));
27    });
28   
29    
30    
31    if($('.ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').length >0)
32    {
33        $('.ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').each(function(){
34            if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
35                $(this).hide();   
36        });
37    }
38    if($('.ets_crosssell_tab_content .list-content').length==1)
39    {
40        $('.ets_crosssell_tab_content .list-content').each(function(){
41            if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
42            {
43                $(this).hide();
44                $('ul.ets_crosssell_nav_tabs').hide();
45            } 
46        });
47    }
48    if(ets_crosssell_16 && $('#product .pb-center-column .ets_crosssell_block').length)
49    {
50        $('#product .pb-right-column').after($('#product .pb-center-column .ets_crosssell_block').clone());
51        $('#product .pb-center-column .ets_crosssell_block').remove();
52    }
53    if(ets_crosssell_16 && $('#order-confirmation .cart_navigation').length && $('.ets_crosssell_block').length)
54    {
55        $('#order-confirmation .cart_navigation').before($('.ets_crosssell_block').clone());
56        $('#order_step').next('.ets_crosssell_block').remove();
57    }
58    ets_crosssell_slide(true);
59    $(document).on('click','.ets_crosssell_tab',function(e){
60        e.preventDefault();
61        var page_name = $(this).data('page');
62        var tab_name = $(this).data('tab');
63        if($($(this).attr('href')).length==0 || $('#tab-content-'+page_name+'-'+tab_name+' .ets_crosssel_sub_category.active').length>0)
64        {
65            if(!$('.ets_crosssell_'+page_name).hasClass('loading'))
66            {
67                var id_product = $(this).data('id_product');
68                $('#'+page_name+'-tabs li').removeClass('active');
69                $(this).parent().addClass('active');
70                $('.ets_crosssell_'+page_name).addClass('loading');
71                $.ajax({
72                    url: '',
73                    data: {
74                        getCrosssellContent:1,
75                        page_name :page_name,
76                        tab : tab_name,
77                        ajax: 1,
78                        id_product:id_product,
79                    },
80                    type: 'post',
81                    dataType: 'json',
82                    success: function(json){
83                        $('#'+page_name+'-contents.ets_crosssell_tab_content .list-content').removeClass('active');
84                        $('.ets_crosssell_'+page_name).removeClass('loading');
85                        if($('#tab-content-'+page_name+'-'+tab_name).length==0)
86                            $('.ets_crosssell_'+page_name+' .ets_crosssell_tab_content').append('<div id="tab-content-'+page_name+'-'+tab_name+'" class="list-content active">'+json.product_list+'</div>');
87                        else{
88                            $('#tab-content-'+page_name+'-'+tab_name).addClass('active').html(json.product_list);
89                        }
90
91
92                        if($('#tab-content-'+page_name+'-'+tab_name+' .ets_cs_sub_categories').length>0)
93                            $('#tab-content-'+page_name+'-'+tab_name).addClass('ets_crosssell_has_sub');
94                        ets_crosssell_slide(false);
95                    },
96                    error: function(xhr, status, error)
97                    {
98                        $(this).removeClass('loading');
99                    }
100                });
101            }
102        }
103        else
104        {
105            $('#'+page_name+'-contents.ets_crosssell_tab_content .list-content').removeClass('active');
106            $('#'+page_name+'-tabs li').removeClass('active');
107            $(this).parent().addClass('active');
108            $($(this).attr('href')).addClass('active');
109        }
110   });
111   $(document).on('click','.ets_crosssell_list',function(e){
112        e.preventDefault();
113        var page_name = $(this).data('page');
114        var tab_name = $(this).data('tab');
115        if($('#tab-content-'+page_name+'-'+tab_name+' .ets_crosssel_sub_category.active').length>0)
116        {
117            if(!$('#tab-content-'+page_name+'-'+tab_name).hasClass('loading'))
118            {
119                var id_product = $(this).data('id_product');
120                $('#'+page_name+'-tabs li').removeClass('active');
121                $(this).parent().addClass('active');
122                $('#tab-content-'+page_name+'-'+tab_name).addClass('loading');
123                $.ajax({
124                    url: '',
125                    data: {
126                        getCrosssellContent:1,
127                        page_name :page_name,
128                        tab : tab_name,
129                        ajax: 1,
130                        id_product:id_product,
131                    },
132                    type: 'post',
133                    dataType: 'json',
134                    success: function(json){
135                        $('.ets_crosssell_tab_content .list-content').removeClass('active');
136                        $('#tab-content-'+page_name+'-'+tab_name).removeClass('loading');
137                        if($('#tab-content-'+page_name+'-'+tab_name).length==0)
138                            $('.ets_crosssell_'+page_name+' .ets_crosssell_tab_content').append('<div id="tab-content-'+page_name+'-'+tab_name+'" class="list-content active">'+json.product_list+'</div>');
139                        else
140                            $('#tab-content-'+page_name+'-'+tab_name).addClass('active').html(json.product_list);
141                        if($('#tab-content-'+page_name+'-'+tab_name+' .ets_cs_sub_categories').length>0)
142                            $('#tab-content-'+page_name+'-'+tab_name).addClass('ets_crosssell_has_sub');
143                        ets_crosssell_slide(false);
144                    },
145                    error: function(xhr, status, error)
146                    {
147                        $('#tab-content-'+page_name+'-'+tab_name).removeClass('loading');
148                    }
149                });
150            }
151        }
152   });
153   $(document).ajaxComplete(function( event, xhr, settings ) {
154      if(settings.data && typeof settings.data !='object' &&  (settings.data.indexOf('action=add-to-cart')>=0 || (settings.data.indexOf('controller=cart')>=0 && settings.data.indexOf('add=1')>=0) )&& settings.data.indexOf('getProductPopupAdded')==-1)
155      {
156            var data_post = settings.data.replace("controller", "page_controller");
157            $.ajax({
158                url: '',
159                data: 'getProductPopupAdded=1&ajax=1&'+data_post,
160                type: 'post',
161                dataType: 'json',
162                success: function(json){
163                    if($('#blockcart-modal').length)
164                    {
165                        if($('#blockcart-modal .ets_crosssell_block').length<=0)
166                            $('#blockcart-modal .modal-body').append(json.product_lists);
167                        else
168                            $('#blockcart-modal .ets_crosssell_block').replaceWith(json.product_lists);
169                        if($('#blockcart-modal .ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').length >0)
170                        {
171                            $('#blockcart-modal .ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').each(function(){
172                                if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
173                                    $(this).hide();   
174                            });
175                        }
176                        if($('#blockcart-modal .ets_crosssell_tab_content .list-content').length==1)
177                        {
178                            $('#blockcart-modal .ets_crosssell_tab_content .list-content').each(function(){
179                                if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
180                                {
181                                    $(this).hide();
182                                    $('#blockcart-modal ul.ets_crosssell_nav_tabs').hide();
183                                } 
184                            });
185                        }
186                    }
187                    else
188                    {
189                        if($('#layer_cart').length)
190                        {
191                            if($('#layer_cart .ets_crosssell_block').length<=0)
192                                $('#layer_cart > .clearfix').append(json.product_lists);
193                            else
194                                $('#layer_cart .ets_crosssell_block').replaceWith(json.product_lists);
195                        }
196                        if($('#layer_cart .ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').length >0)
197                        {
198                            $('#layer_cart .ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').each(function(){
199                                if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
200                                    $(this).hide();   
201                            });
202                        }
203                        if($('#layer_cart .ets_crosssell_tab_content .list-content').length==1)
204                        {
205                            $('#layer_cart .ets_crosssell_tab_content .list-content').each(function(){
206                                if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
207                                {
208                                    $(this).hide();
209                                    $('#layer_cart ul.ets_crosssell_nav_tabs').hide();
210                                } 
211                            });
212                        }
213                    }
214                    ets_crosssell_slide(false);
215                },
216                error: function(xhr, status, error)
217                {
218                    $(this).removeClass('loading');
219                }
220            });
221      }
222      if(xhr.responseText && xhr.responseText.indexOf("quickview_html")>=0)
223      { 
224            setTimeout(function(){ets_crosssell_slide(false);},500);
225            if($('.quickview .ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').length >0)
226            {
227                $('.quickview .ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').each(function(){
228                    if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
229                        $(this).hide();   
230                });
231            }
232            if($('.quickview .ets_crosssell_tab_content .list-content').length==1)
233            {
234                $('.quickview .ets_crosssell_tab_content .list-content').each(function(){
235                    if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
236                    {
237                        $(this).hide();
238                        $('.quickview ul.ets_crosssell_nav_tabs').hide();
239                    } 
240                });
241            }
242      }
243    });
244    if(!ets_crosssell_16 && $('.cart-grid-body .ets_crosssell_block').length >0)
245    {
246        $('.cart-grid.row').after($('.cart-grid-body .ets_crosssell_block').clone());
247        $('.cart-grid-body .ets_crosssell_block').remove();
248        ets_crosssell_slide(false);
249    }
250    if(ets_crosssell_16 && ($('body#category').length||$('body#cms').length||$('body#contact').length))
251    {
252        $.ajax({
253            url: '',
254            data: 'getProductExtraPage=1&ajax=1',
255            type: 'post',
256            dataType: 'json',
257            success: function(json){
258                $('#center_column').append(json.product_lists);
259                ets_crosssell_slide(false);
260                if($('.ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').length >0)
261                {
262                    $('.ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').each(function(){
263                        if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
264                            $(this).hide();   
265                    });
266                }
267                if($('.ets_crosssell_tab_content .list-content').length==1)
268                {
269                    $('.ets_crosssell_tab_content .list-content').each(function(){
270                        if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
271                        {
272                            $(this).hide();
273                            $('ul.ets_crosssell_nav_tabs').hide();
274                        } 
275                    });
276                }
277            },
278            error: function(xhr, status, error)
279            {
280                
281            }
282        });
283    }
284    $(document).on('change','.ets_crosssel_sort_by',function(){
285        var page_name = $(this).data('page');
286        var tab_name = $(this).data('tab');
287        var id_product = $(this).data('id_product');
288        var sort_by = $(this).val();
289        if(!$('#tab-content-'+page_name+'-'+tab_name).hasClass('loading'))
290        {
291            $('#tab-content-'+page_name+'-'+tab_name).addClass('loading');
292            if($('#tab-content-'+page_name+'-'+tab_name+' .ets_crosssel_sub_category.active').length>0)
293            {
294                var id_ets_css_sub_category =$('#tab-content-'+page_name+'-'+tab_name+' .ets_crosssel_sub_category.active').data('id_category')
295            }
296            else
297                var id_ets_css_sub_category = 0;
298            $.ajax({
299                url: '',
300                data: {
301                    sortProductsCrosssellContent:1,
302                    page_name :page_name,
303                    tab : tab_name,
304                    ajax: 1,
305                    id_product:id_product,
306                    sort_by : sort_by,
307                    id_ets_css_sub_category : id_ets_css_sub_category
308                },
309                type: 'post',
310                dataType: 'json',
311                success: function(json){
312                    $('#tab-content-'+page_name+'-'+tab_name).removeClass('loading');
313                    $('#tab-content-'+page_name+'-'+tab_name).html(json.product_list);
314                    ets_crosssell_slide(false);
315                },
316                error: function(xhr, status, error)
317                {
318                    $(this).removeClass('loading');
319                }
320            });
321        }
322        
323    });
324    $(document).on('click','.ets_crosssel_sub_category',function(){
325        var page_name = $(this).data('page');
326        var tab_name = $(this).data('tab');
327        var id_product = $(this).data('id_product');
328        if($('#tab-content-'+page_name+'-'+tab_name+' .ets_crosssel_sort_by').length>0)
329            var sort_by = $('#tab-content-'+page_name+'-'+tab_name+' .ets_crosssel_sort_by').val();
330        else
331            var sort_by = $(this).val();
332        if(!$('#tab-content-'+page_name+'-'+tab_name).hasClass('loading'))
333        {
334            
335            $('#tab-content-'+page_name+'-'+tab_name).addClass('loading');
336            var id_ets_css_sub_category = $(this).data('id_category')
337            $.ajax({
338                url: '',
339                data: {
340                    sortProductsCrosssellContent:1,
341                    page_name :page_name,
342                    tab : tab_name,
343                    ajax: 1,
344                    id_product:id_product,
345                    sort_by : sort_by,
346                    id_ets_css_sub_category : id_ets_css_sub_category
347                },
348                type: 'post',
349                dataType: 'json',
350                success: function(json){
351                    $('#tab-content-'+page_name+'-'+tab_name).removeClass('loading');
352                    $('#tab-content-'+page_name+'-'+tab_name).html(json.product_list);
353                    ets_crosssell_slide(false);
354                },
355                error: function(xhr, status, error)
356                {
357                    $(this).removeClass('loading');
358                }
359            });
360        }
361        return false;
362    });
363});
364function ets_crosssell_slide(check_cart)
365{
366    prestashop.iqitLazyLoad.update();
367    if(check_cart && $('.crosssell_product_list_wrapper').hasClass('cart_page'))
368        return false;
369    if($('.crosssell_product_list_wrapper.layout-slide:not(.slick-slider):not(.product_list_16)').length >0)
370    {
371       $('.crosssell_product_list_wrapper.layout-slide:not(.slick-slider):not(.product_list_16)').slick({
372          slidesToShow: nbItemsPerLine,
373          slidesToScroll: 1,
374          arrows: true,
375          responsive: [
376              {
377                  breakpoint: 1199,
378                  settings: {
379                      slidesToShow: nbItemsPerLine
380                  }
381              },
382              {
383                  breakpoint: 992,
384                  settings: {
385                      slidesToShow: nbItemsPerLineTablet
386                  }
387              },
388              {
389                  breakpoint: 768,
390                  settings: {
391                      slidesToShow: nbItemsPerLineMobile
392                  }
393              },
394              {
395                  breakpoint: 480,
396                  settings: {
397                    slidesToShow: nbItemsPerLineMobile
398                  }
399              }
400           ]
401       });
402   }
403   
404   if($('.crosssell_product_list_wrapper.layout-slide.product_list_16:not(.slick-slider) .product_list').length >0)
405    {
406       $('.crosssell_product_list_wrapper.layout-slide.product_list_16:not(.slick-slider) .product_list').slick({
407          slidesToShow: nbItemsPerLine,
408          slidesToScroll: 1,
409          arrows: true,
410          responsive: [
411              {
412                  breakpoint: 1199,
413                  settings: {
414                      slidesToShow: nbItemsPerLine
415                  }
416              },
417              {
418                  breakpoint: 992,
419                  settings: {
420                      slidesToShow: nbItemsPerLineTablet
421                  }
422              },
423              {
424                  breakpoint: 768,
425                  settings: {
426                      slidesToShow: nbItemsPerLineMobile
427                  }
428              },
429              {
430                  breakpoint: 480,
431                  settings: {
432                    slidesToShow: nbItemsPerLineMobile
433                  }
434              }
435           ]
436       }); 
437       
438   }
439    
440}
441
442
443$(window).load(function(){
444    setTimeout(function(){
445         $('#checkout .crosssell_product_list_wrapper .js-product-miniature-wrapper').each(function(){
446            var $this=$(this);
447            $this.find('.product-thumbnail img:last-child').attr("src",$this.find('.product-thumbnail img:last-child').attr("data-src")).removeClass('js-lazy-product-image');
448            $this.find('.product-thumbnail img:first-child').attr("src",$this.find('.product-thumbnail img:first-child').attr("data-src")).removeClass('js-lazy-product-image');
449        }); 
450     
451    if($('.crosssell_product_list_wrapper.layout-slide:not(.slick-slider):not(.product_list_16)').length >0)
452    {
453       $('.crosssell_product_list_wrapper.layout-slide:not(.slick-slider):not(.product_list_16)').slick({
454          slidesToShow: nbItemsPerLine,
455          slidesToScroll: 1,
456          arrows: true,
457          responsive: [
458              {
459                  breakpoint: 1199,
460                  settings: {
461                      slidesToShow: nbItemsPerLine
462                  }
463              },
464              {
465                  breakpoint: 992,
466                  settings: {
467                      slidesToShow: nbItemsPerLineTablet
468                  }
469              },
470              {
471                  breakpoint: 768,
472                  settings: {
473                      slidesToShow: nbItemsPerLineMobile
474                  }
475              },
476              {
477                  breakpoint: 480,
478                  settings: {
479                    slidesToShow: nbItemsPerLineMobile
480                  }
481              }
482           ]
483       });
484   } 
485    },3000);
486});

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.