Subversion Repositories wpShopGermany4

Rev

Rev 6669 | Rev 7472 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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