1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
/**
* Funktion für das Modul basketteaser
* Fügt die Produkte im Warenkorb ein
*/
function wpsg_mod_basketteaser_add(produkt_id)
{
var menge = jQuery('.wpsg_mod_basketteaser_row_' + produkt_id + ' input').val();
if (menge <= 0) menge = 1;
location.href = wpsg_ajax.ajaxurl + '?wpsg[menge]=' + menge + '&wpsg[produkt_id]=' + produkt_id + '&wpsg[submit]=1';
return false;
} // wpsg_mod_basketteaser_add(produkt_id)
/**
* Aktualisiert ein eventuell eingebundenes Warenkorbwidget
*/
function wpsg_refreshBasketWidget()
{
if (jQuery('.wpsg_basket_widget').length <= 0) return;
jQuery('.wpsg_basket_widget').html('<img class="loading" src="' + wpsg_ajax.img_ajaxloading + '" alt="' + wpsg_ajax.label_pleasewait + '" />');
jQuery.ajax( {
url: wpsg_ajax.url_basket,
data: {
'wpsg[ajax]': 1,
'wpsg[action]': 'widget'
},
success: function(data) {
jQuery('.wpsg_basket_widget').html(data);
}
} );
} // function wpsg_refreshBasketWidget()
function wpsg_customerquestion(url_redirect)
{
jQuery('body,html').addClass('wpsg_noscroll');
jQuery('body').append('<div id="wpsg_calc_layer"><div class="content"><img class="loading" src="' + wpsg_ajax.img_ajaxloading + '" alt="' + wpsg_ajax.label_pleasewait + '" /></div></div>');
jQuery.ajax( {
url: wpsg_ajax.url_basket,
data: {
'wpsg[ajax]': 1,
'wpsg[action]': 'customerquestion',
'wpsg[url]': url_redirect
},
success: function(data) {
jQuery('#wpsg_calc_layer .content').html(data);
}
} );
return false;
}
/**
* Sperrt die Funktionen im Produkttemplate, während einer Ajax Aktion
* @param template_index
*/
function wpsg_blockProductTemplate(template_index)
{
jQuery('#wpsg_produktform_' + template_index).append('<div class="wpsg_product_layer"><img src="' + wpsg_ajax.img_ajaxloading + '" alt="' + wpsg_ajax.label_pleasewait + '" /></div>');
} // function wpsg_blockProductTemplate(template_index)
/**
* Entsperrt die Funktionen im Produkttemplate nach einer Ajax Aktion
* @param template_index
*/
function wpsg_unblockProductTemplate(template_index)
{
jQuery('#wpsg_produktform_' + template_index + ' .wpsg_product_layer').remove();
} // function wpsg_unblockProductTemplate(template_index)
wpsg_numberformat = function (number, decimals, dec_point, thousands_sep)
{
var n = !isFinite(+number) ? 0 : +number,
prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
s = '',
toFixedFix = function (n, prec)
{
var k = Math.pow(10, prec);
return '' + Math.round(n * k) / k;
};
s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
if (s[0].length > 3)
{
s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
}
if ((s[1] || '').length < prec)
{
s[1] = s[1] || '';
s[1] += new Array(prec - s[1].length + 1).join('0');
}
return s.join(dec);
};
wpsg_tf = function(value)
{
if (value == null) return;
if (typeof value == "number") return parseFloat(value);
if (value.lastIndexOf(".") == -1)
{
// 1500,50
return parseFloat(value.replace(/,/, "."));
}
else
{
if (value.lastIndexOf(",") == -1)
{
// 1500.50
return parseFloat(value);
}
else
{
if (value.lastIndexOf(",") > value.lastIndexOf("."))
{
// 1.500,50
return parseFloat(value.replace(/\./, "").replace(/,/, "."));
}
else
{
// 1,500.50
return parseFloat(value.replace(/,/, ""));
}
}
}
};
|