PageSourceSearch

https://outiror.com/modules/ets_crosssell/views/js/front.js

js outiror.com collected 2026-10-01 14:46:45 UTC 20,996 bytes, 454 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    if($('.ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').length >0)
24    {
25        $('.ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').each(function(){
26            if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
27                $(this).hide();   
28        });
29    }
30    if($('.ets_crosssell_tab_content .list-content').length==1)
31    {
32        $('.ets_crosssell_tab_content .list-content').each(function(){
33            if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
34            {
35                $(this).hide();
36                $('ul.ets_crosssell_nav_tabs').hide();
37            } 
38        });
39    }
40    if(ets_crosssell_16 && $('#product .pb-center-column .ets_crosssell_block').length)
41    {
42        $('#product .pb-right-column').after($('#product .pb-center-column .ets_crosssell_block').clone());
43        $('#product .pb-center-column .ets_crosssell_block').remove();
44    }
45    if(ets_crosssell_16 && $('#order-confirmation .cart_navigation').length && $('.ets_crosssell_block').length)
46    {
47        $('#order-confirmation .cart_navigation').before($('.ets_crosssell_block').clone());
48        $('#order_step').next('.ets_crosssell_block').remove();
49    }
50    ets_crosssell_slide(true);
51    $(document).on('click','.ets_crosssell_tab',function(e){
52        e.preventDefault();
53        var page_name = $(this).data('page');
54        var tab_name = $(this).data('tab');
55        if($($(this).attr('href')).length==0 || $('#tab-content-'+page_name+'-'+tab_name+' .ets_crosssel_sub_category.active').length>0)
56        {
57            if(!$('.ets_crosssell_'+page_name).hasClass('loading'))
58            {
59                var id_product = $(this).data('id_product');
60                $('#'+page_name+'-tabs li').removeClass('active');
61                $(this).parent().addClass('active');
62                $('.ets_crosssell_'+page_name).addClass('loading');
63                $.ajax({
64                    url: '',
65                    data: {
66                        getCrosssellContent:1,
67                        page_name :page_name,
68                        tab : tab_name,
69                        ajax: 1,
70                        id_product:id_product,
71                    },
72                    type: 'post',
73                    dataType: 'json',
74                    success: function(json){
75                        $('#'+page_name+'-contents.ets_crosssell_tab_content .list-content').removeClass('active');
76                        $('.ets_crosssell_'+page_name).removeClass('loading');
77                        if($('#tab-content-'+page_name+'-'+tab_name).length==0)
78                            $('.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>');
79                        else{
80                            $('#tab-content-'+page_name+'-'+tab_name).addClass('active').html(json.product_list);
81                        }
82
83
84                        if($('#tab-content-'+page_name+'-'+tab_name+' .ets_cs_sub_categories').length>0)
85                            $('#tab-content-'+page_name+'-'+tab_name).addClass('ets_crosssell_has_sub');
86                        ets_crosssell_slide(false);
87                    },
88                    error: function(xhr, status, error)
89                    {
90                        $(this).removeClass('loading');
91                    }
92                });
93            }
94        }
95        else
96        {
97            $('#'+page_name+'-contents.ets_crosssell_tab_content .list-content').removeClass('active');
98            $('#'+page_name+'-tabs li').removeClass('active');
99            $(this).parent().addClass('active');
100            $($(this).attr('href')).addClass('active');
101        }
102   });
103   $(document).on('click','.ets_crosssell_list',function(e){
104        e.preventDefault();
105        var page_name = $(this).data('page');
106        var tab_name = $(this).data('tab');
107        if($('#tab-content-'+page_name+'-'+tab_name+' .ets_crosssel_sub_category.active').length>0)
108        {
109            if(!$('#tab-content-'+page_name+'-'+tab_name).hasClass('loading'))
110            {
111                var id_product = $(this).data('id_product');
112                $('#'+page_name+'-tabs li').removeClass('active');
113                $(this).parent().addClass('active');
114                $('#tab-content-'+page_name+'-'+tab_name).addClass('loading');
115                $.ajax({
116                    url: '',
117                    data: {
118                        getCrosssellContent:1,
119                        page_name :page_name,
120                        tab : tab_name,
121                        ajax: 1,
122                        id_product:id_product,
123                    },
124                    type: 'post',
125                    dataType: 'json',
126                    success: function(json){
127                        $('.ets_crosssell_tab_content .list-content').removeClass('active');
128                        $('#tab-content-'+page_name+'-'+tab_name).removeClass('loading');
129                        if($('#tab-content-'+page_name+'-'+tab_name).length==0)
130                            $('.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>');
131                        else
132                            $('#tab-content-'+page_name+'-'+tab_name).addClass('active').html(json.product_list);
133                        if($('#tab-content-'+page_name+'-'+tab_name+' .ets_cs_sub_categories').length>0)
134                            $('#tab-content-'+page_name+'-'+tab_name).addClass('ets_crosssell_has_sub');
135                        ets_crosssell_slide(false);
136                    },
137                    error: function(xhr, status, error)
138                    {
139                        $('#tab-content-'+page_name+'-'+tab_name).removeClass('loading');
140                    }
141                });
142            }
143        }
144   });
145   $(document).ajaxComplete(function( event, xhr, settings ) {
146      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)
147      {
148            if ( $('#blockcart-modal').prev('.modal-backdrop.in').length ){
149                $('#blockcart-modal').prev('.modal-backdrop.in').remove();
150            }
151            var data_post = settings.data.replace("controller", "page_controller");
152            $.ajax({
153                url: '',
154                data: 'getProductPopupAdded=1&ajax=1&'+data_post,
155                type: 'post',
156                dataType: 'json',
157                success: function(json){
158                    if($('#blockcart-modal').length)
159                    {
160                        if ( $('#blockcart-modal').prev('.modal-backdrop.in').length ){
161                            $('#blockcart-modal').prev('.modal-backdrop.in').remove();
162                        }
163                        if($('#blockcart-modal .ets_crosssell_block').length<=0)
164                            $('#blockcart-modal .modal-body').append(json.product_lists);
165                        else
166                            $('#blockcart-modal .ets_crosssell_block').replaceWith(json.product_lists);
167                        if($('#blockcart-modal .ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').length >0)
168                        {
169                            $('#blockcart-modal .ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').each(function(){
170                                if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
171                                    $(this).hide();   
172                            });
173                        }
174                        if($('#blockcart-modal .ets_crosssell_tab_content .list-content').length==1)
175                        {
176                            $('#blockcart-modal .ets_crosssell_tab_content .list-content').each(function(){
177                                if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
178                                {
179                                    $(this).hide();
180                                    $('#blockcart-modal ul.ets_crosssell_nav_tabs').hide();
181                                } 
182                            });
183                        }
184                        
185                    }
186                    else
187                    {
188                        if($('#layer_cart').length)
189                        {
190                            if($('#layer_cart .ets_crosssell_block').length<=0)
191                                $('#layer_cart > .clearfix').append(json.product_lists);
192                            else
193                                $('#layer_cart .ets_crosssell_block').replaceWith(json.product_lists);
194                        }
195                        if($('#layer_cart .ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').length >0)
196                        {
197                            $('#layer_cart .ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').each(function(){
198                                if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
199                                    $(this).hide();   
200                            });
201                        }
202                        if($('#layer_cart .ets_crosssell_tab_content .list-content').length==1)
203                        {
204                            $('#layer_cart .ets_crosssell_tab_content .list-content').each(function(){
205                                if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
206                                {
207                                    $(this).hide();
208                                    $('#layer_cart ul.ets_crosssell_nav_tabs').hide();
209                                } 
210                            });
211                        }
212                    }
213                    ets_crosssell_slide(false);
214                    
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            
226            if($('.quickview .ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').length >0)
227            {
228                $('.quickview .ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').each(function(){
229                    if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
230                        $(this).hide();   
231                });
232            }
233            if($('.quickview .ets_crosssell_tab_content .list-content').length==1)
234            {
235                $('.quickview .ets_crosssell_tab_content .list-content').each(function(){
236                    if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
237                    {
238                        $(this).hide();
239                        $('.quickview ul.ets_crosssell_nav_tabs').hide();
240                    } 
241                });
242            }
243            
244      }
245    });
246    if(!ets_crosssell_16 && $('.cart-grid-body .ets_crosssell_block').length >0)
247    {
248        $('.cart-grid.row').after($('.cart-grid-body .ets_crosssell_block').clone());
249        $('.cart-grid-body .ets_crosssell_block').remove();
250        ets_crosssell_slide(false);
251    }
252    if(ets_crosssell_16 && ($('body#category').length||$('body#cms').length||$('body#contact').length))
253    {
254        $.ajax({
255            url: '',
256            data: 'getProductExtraPage=1&ajax=1',
257            type: 'post',
258            dataType: 'json',
259            success: function(json){
260                $('#center_column').append(json.product_lists);
261                ets_crosssell_slide(false);
262                if($('.ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').length >0)
263                {
264                    $('.ets_crosssell_block.layout_list li.ets_crosssell_list_blocks').each(function(){
265                        if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
266                            $(this).hide();   
267                    });
268                }
269                if($('.ets_crosssell_tab_content .list-content').length==1)
270                {
271                    $('.ets_crosssell_tab_content .list-content').each(function(){
272                        if($(this).find('.product-miniature').length==0 && $(this).find('.product-container').length==0)
273                        {
274                            $(this).hide();
275                            $('ul.ets_crosssell_nav_tabs').hide();
276                        } 
277                    });
278                }
279            },
280            error: function(xhr, status, error)
281            {
282                
283            }
284        });
285    }
286    $(document).on('change','.ets_crosssel_sort_by',function(){
287        var page_name = $(this).data('page');
288        var tab_name = $(this).data('tab');
289        var id_product = $(this).data('id_product');
290        var sort_by = $(this).val();
291        if(!$('#tab-content-'+page_name+'-'+tab_name).hasClass('loading'))
292        {
293            $('#tab-content-'+page_name+'-'+tab_name).addClass('loading');
294            if($('#tab-content-'+page_name+'-'+tab_name+' .ets_crosssel_sub_category.active').length>0)
295            {
296                var id_ets_css_sub_category =$('#tab-content-'+page_name+'-'+tab_name+' .ets_crosssel_sub_category.active').data('id_category')
297            }
298            else
299                var id_ets_css_sub_category = 0;
300            $.ajax({
301                url: '',
302                data: {
303                    sortProductsCrosssellContent:1,
304                    page_name :page_name,
305                    tab : tab_name,
306                    ajax: 1,
307                    id_product:id_product,
308                    sort_by : sort_by,
309                    id_ets_css_sub_category : id_ets_css_sub_category
310                },
311                type: 'post',
312                dataType: 'json',
313                success: function(json){
314                    $('#tab-content-'+page_name+'-'+tab_name).removeClass('loading');
315                    $('#tab-content-'+page_name+'-'+tab_name).html(json.product_list);
316                    ets_crosssell_slide(false);
317                },
318                error: function(xhr, status, error)
319                {
320                    $(this).removeClass('loading');
321                }
322            });
323        }
324        
325    });
326    $(document).on('click','.ets_crosssel_sub_category',function(){
327        var page_name = $(this).data('page');
328        var tab_name = $(this).data('tab');
329        var id_product = $(this).data('id_product');
330        if($('#tab-content-'+page_name+'-'+tab_name+' .ets_crosssel_sort_by').length>0)
331            var sort_by = $('#tab-content-'+page_name+'-'+tab_name+' .ets_crosssel_sort_by').val();
332        else
333            var sort_by = $(this).val();
334        if(!$('#tab-content-'+page_name+'-'+tab_name).hasClass('loading'))
335        {
336            
337            $('#tab-content-'+page_name+'-'+tab_name).addClass('loading');
338            var id_ets_css_sub_category = $(this).data('id_category')
339            $.ajax({
340                url: '',
341                data: {
342                    sortProductsCrosssellContent:1,
343                    page_name :page_name,
344                    tab : tab_name,
345                    ajax: 1,
346                    id_product:id_product,
347                    sort_by : sort_by,
348                    id_ets_css_sub_category : id_ets_css_sub_category
349                },
350                type: 'post',
351                dataType: 'json',
352                success: function(json){
353                    $('#tab-content-'+page_name+'-'+tab_name).removeClass('loading');
354                    $('#tab-content-'+page_name+'-'+tab_name).html(json.product_list);
355                    ets_crosssell_slide(false);
356                },
357                error: function(xhr, status, error)
358                {
359                    $(this).removeClass('loading');
360                }
361            });
362        }
363        return false;
364    });
365});
366function ets_crosssell_slide(check_cart)
367{
368    if(check_cart && $('.crosssell_product_list_wrapper').hasClass('cart_page'))
369        return false;
370    if($('.crosssell_product_list_wrapper.layout-slide:not(.slick-slider):not(.product_list_16)').length >0)
371    {
372       $('.crosssell_product_list_wrapper.layout-slide:not(.slick-slider):not(.product_list_16)').slick({
373          slidesToShow: nbItemsPerLine,
374          slidesToScroll: 1,
375          arrows: true,
376          responsive: [
377              {
378                  breakpoint: 1199,
379                  settings: {
380                      slidesToShow: nbItemsPerLine
381                  }
382              },
383              {
384                  breakpoint: 992,
385                  settings: {
386                      slidesToShow: nbItemsPerLineTablet
387                  }
388              },
389              {
390                  breakpoint: 768,
391                  settings: {
392                      slidesToShow: nbItemsPerLineMobile
393                  }
394              },
395              {
396                  breakpoint: 480,
397                  settings: {
398                    slidesToShow: 1
399                  }
400              }
401           ]
402       });
403   }
404   
405   if($('.crosssell_product_list_wrapper.layout-slide.product_list_16:not(.slick-slider) .product_list').length >0)
406    {
407       $('.crosssell_product_list_wrapper.layout-slide.product_list_16:not(.slick-slider) .product_list').slick({
408          slidesToShow: nbItemsPerLine,
409          slidesToScroll: 1,
410          arrows: true,
411          responsive: [
412              {
413                  breakpoint: 1199,
414                  settings: {
415                      slidesToShow: nbItemsPerLine
416                  }
417              },
418              {
419                  breakpoint: 992,
420                  settings: {
421                      slidesToShow: nbItemsPerLineTablet
422                  }
423              },
424              {
425                  breakpoint: 768,
426                  settings: {
427                      slidesToShow: nbItemsPerLineMobile
428                  }
429              },
430              {
431                  breakpoint: 480,
432                  settings: {
433                    slidesToShow: 1
434                  }
435              }
436           ]
437       }); 
438       
439   }
440   if ( $('.quickview').prev('.modal-backdrop.in').length ){
441        $('.quickview').prev('.modal-backdrop.in').remove();
442   }
443   if ( $('.quickview').prev('.modal.fade.quickview.in').length ){
444        $('.quickview').prev('.modal.fade.quickview.in').remove();
445   }
446   if ( $('.quickview').prev('.modal.fade').length ){
447        $('.quickview').prev('.modal.fade').remove();
448   }
449   $( ".quick_view_page .product-miniature" ).each(function( ) {
450      var flag_online_height = $(this).find('.product-flag.online-only').height();
451      var space_top_height = $(this).find('a.thumbnail.product-thumbnail').height() - flag_online_height - 15;
452      $(this).find('.product-flag.online-only').css('top',space_top_height+'px');
453   });
454}

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.