diff options
| author | hartmut <noreply@maennchen1.de> | 2017-03-30 08:51:31 +0000 |
|---|---|---|
| committer | hartmut <noreply@maennchen1.de> | 2017-03-30 08:51:31 +0000 |
| commit | 26a7ba1e072e7420618ab3c0d3e61027ae781fce (patch) | |
| tree | 366657440cd6ec12f177742028fe355a67bc5b1e /views/mods/mod_productvariants/frontend.js | |
| parent | a1a8ddb3a84a5edcc9e5a3ff0105c5ba553ac600 (diff) | |
Korrektur Varianten
git-svn-id: https://[internal]/wordpress/plugins/wpsg4@6165 0d5edaf7-2b12-4e95-93f4-047927463d4b
Diffstat (limited to 'views/mods/mod_productvariants/frontend.js')
| -rw-r--r-- | views/mods/mod_productvariants/frontend.js | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/views/mods/mod_productvariants/frontend.js b/views/mods/mod_productvariants/frontend.js index a6d62fa..836bbdc 100644 --- a/views/mods/mod_productvariants/frontend.js +++ b/views/mods/mod_productvariants/frontend.js @@ -1,4 +1,71 @@ + var wpsg_vp_vari = new Array();
+
+ function wpsg_vp_switch(product_id, product_index)
+ {
+
+ var var_key = 'pv_' + product_id + "|";
+ //alert('Länge: ' + wpsg_vp_vari[product_id].length);
+
+ for (var i = 0; i < wpsg_vp_vari[product_id].length; i ++)
+ {
+
+ vkey1 = i + ":";
+ vkey2 = '';
+
+ if (wpsg_vp_vari[product_id][i] == "select")
+ {
+ vkey2 = jQuery('#wpsg_produktform_' + product_index + ' .wpsg_produkt_' + product_id + " #wpsg_vpfield_" + product_id + "_" + i).val();
+ }
+ else if (wpsg_vp_vari[product_id][i] == "radio")
+ {
+ vkey2 = 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")
+ {
+ vkey2 = 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")
+ {
+ vkey2 = jQuery('#wpsg_produktform_' + product_index + ' .wpsg_produkt_' + product_id + ' .wpsg_mod_productvariants_imageselect_' + i + ' .akt').attr("data-wpsg-id");
+ }
+
+ if (vkey2 != '') {
+ if (wpsg_vp_vari[product_id][i] == "image")
+ jQuery('#wpsg_vp_' + i).val(vkey2);
+ var_key += vkey1 + vkey2;
+ if (i < (wpsg_vp_vari[product_id].length - 1)) var_key += "|";
+ }
+ }
+
+ //console.log(jQuery('#wpsg_produktform_' + product_index).serialize());
+ //console.log(var_key);
+ //return;
+
+ 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_productvariants_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)
+
function wpsg_mod_productvariants_reload(event)
{
|
