From 24cc55213fa39bd2c2e3215943f22bef731e58fb Mon Sep 17 00:00:00 2001 From: Daniel Schmitzer Date: Wed, 21 Sep 2016 10:55:51 +0000 Subject: - Select im Editable zeigt gesetzten Wert - Varianten im Frontend angezeigt und schalten Produkt um - Warnungen raus git-svn-id: https://[internal]/wordpress/plugins/wpsg4@5767 0d5edaf7-2b12-4e95-93f4-047927463d4b --- views/js/editable.js | 17 ++++++++-- views/mods/mod_productvariants/frontend.js | 25 ++++++++++++++ .../mods/mod_productvariants/productTemplate.phtml | 38 ++++++++++++++++++++-- views/produkt/addedit_price.phtml | 2 +- 4 files changed, 76 insertions(+), 6 deletions(-) diff --git a/views/js/editable.js b/views/js/editable.js index c2275ec..9717064 100644 --- a/views/js/editable.js +++ b/views/js/editable.js @@ -28,10 +28,23 @@ if (options.type == "select" && typeof options.data == "string") { + var ar = []; + var arData = jQuery.parseJSON(options.data); + var strValue = jQuery(this).html(); + var value = 0; + + for (var i in arData) + { + + ar.push( { 'value': i, 'text': arData[i] } ); + if (arData[i] == strValue) value = i; + + } + // Normale Übergabe eines JSON Strings - opt.source = jQuery.parseJSON(options.data); + opt.source = ar; opt.type = 'select'; - opt.value = options.value; + opt.value = value; } else if (options.type == 'multiarray') diff --git a/views/mods/mod_productvariants/frontend.js b/views/mods/mod_productvariants/frontend.js index e69de29..a6d62fa 100644 --- a/views/mods/mod_productvariants/frontend.js +++ b/views/mods/mod_productvariants/frontend.js @@ -0,0 +1,25 @@ + + function wpsg_mod_productvariants_reload(event) + { + + var product_index = jQuery(event.target).parents('.wpsg_mod_productvariants_product_wrap').attr('wpsg-productindex'); + + //jQuery('#wpsg_produktform_' + product_index).append('
' + wpsg_ajax.label_pleasewait + '
'); + + 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(), + 'form_data': jQuery('#wpsg_produktform_' + product_index).serialize(), + 'product_index': product_index + }, + 'success': function(data) { + + jQuery('#wpsg_produktform_' + product_index).replaceWith(data); + + } + } ); + + } // function wpsg_mod_productvariants_reload(event) \ No newline at end of file diff --git a/views/mods/mod_productvariants/productTemplate.phtml b/views/mods/mod_productvariants/productTemplate.phtml index 35f873a..0f472f5 100644 --- a/views/mods/mod_productvariants/productTemplate.phtml +++ b/views/mods/mod_productvariants/productTemplate.phtml @@ -3,17 +3,49 @@ /** * Integration der Variantenauswahl in die Produktverwaltung */ - + ?> -
+
view['wpsg_mod_productvariants']['arVariants'] as $var) { ?> -
+
"> + + + + + + + + + + + + + +
+ + +
diff --git a/views/produkt/addedit_price.phtml b/views/produkt/addedit_price.phtml index 445b0c4..fa03f32 100644 --- a/views/produkt/addedit_price.phtml +++ b/views/produkt/addedit_price.phtml @@ -2,7 +2,7 @@ view['data']['mwst_key']); ?> getBackendTaxview() === WPSG_NETTO)?'NETTO':'BRUTTO')), wpsg_ff($this->view['data']['preis'])); ?> getBackendTaxview() === WPSG_NETTO)?'NETTO':'BRUTTO')), wpsg_ff($this->view['data']['oldprice'])); ?> - view['data']['tax_sum_value'], $this->get_option('wpsg_currency')).' / '.$this->getDefaultCountry()->kuerzel, array('text' => true)); ?> + view['data']['tax_sum_value'], $this->get_option('wpsg_currency')).' / '.$this->getDefaultCountry()->kuerzel, array('text' => true)); ?> view['data']['euleistungsortregel'], array('fullrow' => true, 'help' => 'EU-Leistungsortregel')); ?> -- cgit v1.2.3