Subversion Repositories wpShopGermany4

Rev

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

Rev Author Line No. Line
5767 daniel 1
 
6165 hartmut 2
	var wpsg_vp_vari = new Array();
3
 
6268 hartmut 4
	function wpsg_vp_switch(product_id, product_index, elem)
6165 hartmut 5
	{
6268 hartmut 6
			 /*
6165 hartmut 7
		var var_key = 'pv_' + product_id + "|";
8
		//alert('Länge: ' + wpsg_vp_vari[product_id].length);
9
 
10
		for (var i = 0; i < wpsg_vp_vari[product_id].length; i ++)
11
		{
12
 
13
			vkey1 = i + ":";
14
			vkey2 = '';
15
 
16
			if (wpsg_vp_vari[product_id][i] == "select")
17
			{
18
				vkey2 = jQuery('#wpsg_produktform_' + product_index + ' .wpsg_produkt_' + product_id + " #wpsg_vpfield_" + product_id + "_" + i).val();
19
			}
20
			else if (wpsg_vp_vari[product_id][i] == "radio")
21
			{
22
				vkey2 = jQuery('#wpsg_produktform_' + product_index + ' .wpsg_produkt_' + product_id + ' input[name="wpsg_vp[' + i + ']"]:checked').val();
23
			}
24
			else if (wpsg_vp_vari[product_id][i] == "checkbox")
25
			{
26
				vkey2 = jQuery('#wpsg_produktform_' + product_index + ' .wpsg_produkt_' + product_id + ' input[name="wpsg_vp[' + i + ']"]:checked').length;
27
			}
28
			else if (wpsg_vp_vari[product_id][i] == "image")
29
			{
30
				vkey2 = jQuery('#wpsg_produktform_' + product_index + ' .wpsg_produkt_' + product_id + ' .wpsg_mod_productvariants_imageselect_' + i + ' .akt').attr("data-wpsg-id");
31
			}
32
 
33
			if (vkey2 != '') {
34
				if (wpsg_vp_vari[product_id][i] == "image")
35
					jQuery('#wpsg_vp_' + i).val(vkey2);
36
				var_key += vkey1 + vkey2;
37
				if (i < (wpsg_vp_vari[product_id].length - 1)) var_key += "|";
38
			}
39
		}
6268 hartmut 40
		 */
6165 hartmut 41
		//console.log(jQuery('#wpsg_produktform_' + product_index).serialize());
42
		//console.log(var_key);
43
		//return;
44
 
6268 hartmut 45
		v1 = jQuery(elem).attr("data-wpsg-id");
46
		//v2 = jQuery(elem).parent().find('input').val();
47
		jQuery(elem).parent().find('input').val(v1);
48
		//alert('v1=' + v1 + ' v2=' + v2);
49
 
6165 hartmut 50
		jQuery('#wpsg_produktform_' + product_index).append('<div class="wpsg_product_layer"><img src="' + wpsg_ajax.img_ajaxloading + '" alt="' + wpsg_ajax.label_pleasewait + '" /></div>');
51
 
52
		jQuery.ajax( {
53
			'url': wpsg_ajax.ajaxurl,
54
			'method': 'get',
55
			'data': {
56
				'action': 'wpsg_productvariants_switch',
57
				'wpsg_post_id': jQuery('#wpsg_produktform_' + product_index + ' input[name="wpsg_post_id"]').val(),
58
				'quantity': jQuery('#wpsg_menge_' + product_index).val(),
59
				'template': jQuery('#wpsg_produktform_' + product_index + ' input[name="wpsg[template]"]').val(),
60
				'referer': jQuery('#wpsg_produktform_' + product_index + ' input[name="myReferer"]').val(),
61
				'form_data': jQuery('#wpsg_produktform_' + product_index).serialize(),
6268 hartmut 62
			//	'product_key': var_key,
6165 hartmut 63
				'product_index': product_index
64
			},
65
			'success': function(data) {
66
 
67
				jQuery('#wpsg_produktform_' + product_index).replaceWith(data);
68
 
69
			}
70
		} );
71
 
72
	} // function wpsg_vp_switch(produkt_id)
73
 
5767 daniel 74
    function wpsg_mod_productvariants_reload(event)
75
    {
76
 
77
        var product_index = jQuery(event.target).parents('.wpsg_mod_productvariants_product_wrap').attr('wpsg-productindex');
78
 
79
        //jQuery('#wpsg_produktform_' + product_index).append('<div class="wpsg_product_layer"><img src="' + wpsg_ajax.img_ajaxloading + '" alt="' + wpsg_ajax.label_pleasewait + '" /></div>');
80
 
81
		jQuery.ajax( {
82
			'url': wpsg_ajax.ajaxurl,
83
			'method': 'get',
84
			'data': {
85
				'action': 'wpsg_productvariants_switch',
86
				'wpsg_post_id': jQuery('#wpsg_produktform_' + product_index + ' input[name="wpsg_post_id"]').val(),
87
				'form_data': jQuery('#wpsg_produktform_' + product_index).serialize(),
88
				'product_index': product_index
89
			},
90
			'success': function(data) {
91
 
92
				jQuery('#wpsg_produktform_' + product_index).replaceWith(data);
93
 
94
			}
95
		} );
96
 
97
    } // function wpsg_mod_productvariants_reload(event)