diff options
| author | Daniel Schmitzer <noreply@maennchen1.de> | 2016-01-14 14:55:36 +0000 |
|---|---|---|
| committer | Daniel Schmitzer <noreply@maennchen1.de> | 2016-01-14 14:55:36 +0000 |
| commit | ad405c7045c6e242080ec9d3ce4c9e586b517c4f (patch) | |
| tree | b41905f4d27f3eaaabd5bad3a39f8d3873540b46 /views/mods/mod_varianten/varianten.js | |
- Testweise 4
git-svn-id: https://[internal]/wordpress/plugins/wpsg4@5261 0d5edaf7-2b12-4e95-93f4-047927463d4b
Diffstat (limited to 'views/mods/mod_varianten/varianten.js')
| -rw-r--r-- | views/mods/mod_varianten/varianten.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/views/mods/mod_varianten/varianten.js b/views/mods/mod_varianten/varianten.js new file mode 100644 index 0000000..f87c626 --- /dev/null +++ b/views/mods/mod_varianten/varianten.js @@ -0,0 +1,58 @@ +
+ var wpsg_vp_vari = new Array();
+
+ function wpsg_vp_switch(product_id, product_index)
+ {
+
+ var var_key = 'vp_' + product_id + "/";
+
+ for (var i = 0; i < wpsg_vp_vari[product_id].length; i ++)
+ {
+
+ var_key += i + "_";
+
+ if (wpsg_vp_vari[product_id][i] == "select")
+ {
+ var_key += jQuery('#wpsg_produktform_' + product_index + ' .wpsg_produkt_' + product_id + " #wpsg_vpfield_" + product_id + "_" + i).val();
+ }
+ else if (wpsg_vp_vari[product_id][i] == "radio")
+ {
+ var_key += jQuery('#wpsg_produktform_' + product_index + ' .wpsg_produkt_' + product_id + ' input[name="wpsg_vp[' + i + ']"]:checked').val();
+ }
+ else if (wpsg_vp_vari[product_id][i] == "checkbox")
+ {
+ var_key += jQuery('#wpsg_produktform_' + product_index + ' .wpsg_produkt_' + product_id + ' input[name="wpsg_vp[' + i + ']"]:checked').length;
+ }
+ else if (wpsg_vp_vari[product_id][i] == "image")
+ {
+ var_key += jQuery('#wpsg_produktform_' + product_index + ' .wpsg_produkt_' + product_id + ' .wpsg_mod_varianten_imageselect_' + i + ' .akt').attr("data-wpsg-id");
+ }
+
+ if (i < (wpsg_vp_vari[product_id].length - 1)) var_key += ":";
+
+ }
+
+ jQuery('#wpsg_produktform_' + product_index).append('<div class="wpsg_product_layer"><img src="' + wpsg_ajax.img_ajaxloading + '" alt="' + wpsg_ajax.label_pleasewait + '" /></div>');
+
+ jQuery.ajax( {
+ 'url': wpsg_ajax.ajaxurl,
+ 'method': 'get',
+ 'data': {
+ 'action': 'wpsg_varianten_switch',
+ 'wpsg_post_id': jQuery('#wpsg_produktform_' + product_index + ' input[name="wpsg_post_id"]').val(),
+ 'quantity': jQuery('#wpsg_menge_' + product_index).val(),
+ 'template': jQuery('#wpsg_produktform_' + product_index + ' input[name="wpsg[template]"]').val(),
+ 'referer': jQuery('#wpsg_produktform_' + product_index + ' input[name="myReferer"]').val(),
+ 'form_data': jQuery('#wpsg_produktform_' + product_index).serialize(),
+ 'product_key': var_key,
+ 'product_index': product_index
+ },
+ 'success': function(data) {
+
+ jQuery('#wpsg_produktform_' + product_index).replaceWith(data);
+
+ }
+ } );
+
+ } // function wpsg_vp_switch(produkt_id)
+
\ No newline at end of file |
