PageSourceSearch

https://www.aerobicyfitness.com/modules/g_relatedcrosssellingprodu…/js/front/g_relatedcrosssellingproducts.js

js aerobicyfitness.com collected 2026-09-29 13:21:58 UTC 7,847 bytes, 180 lines download raw bytes

1/**
2* This is main js file. Don't edit the file if you want to update module in future.
3* 
4* @author    Globo Software Solution JSC <[email protected]>
5* @copyright 2018 Globo JSC
6* @license   please read license in file license.txt
7* @link	     http://www.globosoftware.net
8*/
9
10function loadOwlSlider(){
11    if($('.owl_slider').length > 0){
12        max_item = 4;
13        if($('body#cart').length > 0) max_item = 3;
14        $('.owl_slider').each(function(){
15            if(!$(this).hasClass('owl-loaded'))
16                $(this).owlCarousel({
17                    loop:true,
18                    margin:10,
19                    responsiveClass:true,
20                    navText : [($('#prevtitle').length > 0 ? $('#prevtitle').html() : 'Prev'),($('#nexttitle').length > 0 ? $('#nexttitle').html() : 'Next')],
21                    responsive:{
22                        0:{
23                            items:1,
24                            nav:true
25                        },
26                        320:{
27                            items:1,
28                            nav:true
29                        },
30                        480:{
31                            items:2,
32                            nav:true,
33                            loop:false
34                        },
35                        768:{
36                            items:2,
37                            nav:true,
38                            loop:false
39                        },
40                        992:{
41                            items:3,
42                            nav:true,
43                            loop:false
44                        },
45                        1200:{
46                            items:max_item,
47                            nav:true,
48                            loop:false
49                        }
50                    }
51                });
52        });
53    }
54}
55$(document).ready(function(){
56    loadOwlSlider();
57    /* for prestashop 1.6 */
58    $(document).on('click','.globo_ajax_add_to_cart_button', function(e){
59        e.preventDefault();
60        if(!$(this).hasClass('disabled'))
61        {
62            idCombination = $(this).attr('data-ipa');
63            idProduct = $(this).attr('data-id-product');
64            dc = $(this).attr('data-dc');
65            $.ajax({
66        		type: 'POST',
67        		headers: { "cache-control": "no-cache" },
68        		url: baseUri + '?rand=' + new Date().getTime(),
69        		async: true,
70        		cache: false,
71        		dataType : "json",
72                data: 'controller=cart&add=1&ajax=true&qty=1&id_product=' + idProduct+'&ipa=' + idCombination + '&token=' + static_token+(dc == 1 ? '&dc=1' : '') ,
73                beforeSend: function(){
74                    $(this).addClass('disabled');
75                },
76                success: function(jsonData)
77                {
78                    ajaxCart.updateCartInformation(jsonData, 0);
79                    if (jsonData.crossSelling)
80						$('.crossseling').html(jsonData.crossSelling);
81                    if (idCombination)
82						$(jsonData.products).each(function(){
83							if (this.id != undefined && this.id == parseInt(idProduct) && this.idCombination == parseInt(idCombination))
84									ajaxCart.updateLayer(this);
85						});
86					else
87						$(jsonData.products).each(function(){
88							if (this.id != undefined && this.id == parseInt(idProduct))
89									ajaxCart.updateLayer(this);
90						});
91                    
92                },
93                error : function(XMLHttpRequest, textStatus, errorThrown){
94                    alert(XMLHttpRequest.responseText);
95                },
96                complete : function(){$(this).removeClass('disabled');}
97            }); 
98        } 
99        return false;
100    });
101    $(document).on('click','.globo_ajax_add_to_cart_button_multi', function(e){
102        e.preventDefault();
103        var parent_box = $(this).parents('.grelated_products_list');
104        parent_box.find('.alert').slideUp(500);
105        if(parent_box.find('.gproducts_multi').length > 0){
106            nbr_checked = parent_box.find('.gproducts_multi:checked').length;
107            if(nbr_checked > 0){ 
108                if(parent_box.hasClass('gps17')){
109                    parent_box.find('.gproducts_multi:checked').each(function(){
110                        idCombination = $(this).attr('data-ipa');
111                        idProduct = $(this).attr('data-id-product');
112                        dc = $(this).attr('data-dc');
113                        $.ajax({
114                    		type: 'POST',
115                    		headers: { "cache-control": "no-cache" },
116                    		url: parent_box.find('.gaction_link').val(),
117                    		async: true,
118                    		cache: false,
119                    		dataType : "json",
120                            data: 'update=1&ajax=true&qty=1&id_product=' + idProduct+'&ipa=' + idCombination + '&token=' + parent_box.find('.gaction_link_token').val()+(dc == 1 ? '&dc=1' : '') ,
121                            beforeSend: function(){
122                               
123                            },
124                            success: function(jsonData)
125                            {
126                            },
127                            complete : function(){
128                                nbr_checked = nbr_checked - 1;
129                                if(nbr_checked <=0){
130                                    window.location.href = parent_box.find('.gaction_link_show').val();
131                                }
132                            }
133                        }); 
134                      
135                    });
136                }else{
137                    parent_box.find('.gproducts_multi:checked').each(function(){
138                        idCombination = $(this).attr('data-ipa');
139                        idProduct = $(this).attr('data-id-product');
140                        dc = $(this).attr('data-dc');
141                        $.ajax({
142                            type: 'POST',
143                            headers: { "cache-control": "no-cache" },
144                            url: baseUri + '?rand=' + new Date().getTime(),
145                            async: true,
146                            cache: false,
147                            dataType : "json",
148                            data: 'controller=cart&add=1&ajax=true&qty=1&id_product=' + idProduct+'&ipa=' + idCombination + '&token=' + static_token+(dc == 1 ? '&dc=1' : '') ,
149                            beforeSend: function(){},
150                            success: function(jsonData){},
151                            error : function(XMLHttpRequest, textStatus, errorThrown){},
152                            complete : function(){
153                                nbr_checked = nbr_checked - 1;
154                                if(nbr_checked <=0){
155                                    window.location.href = parent_box.find('.gaction_link_show').val();
156                                }
157                            }
158                        });  
159                        });
160                }
161            }else{
162                parent_box.find('.alert-danger').slideDown(500);
163                $('html,body').animate({
164                    scrollTop: parent_box.find('.alert-danger').offset().top - 20
165                }, 'slow');
166            }
167        }else{
168            parent_box.find('.alert-danger').slideDown(500);
169            $('html,body').animate({
170                scrollTop: parent_box.find('.alert-danger').offset().top - 20
171            }, 'slow');
172        }
173        return false;
174    });
175    
176    $('.gproducts_multi').change(function(){
177        $(this).parents('.grelated_products_list').find('.alert-danger').slideUp(500);
178    })
179    
180})

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.