summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/js/editable.js17
-rw-r--r--views/mods/mod_productvariants/frontend.js25
-rw-r--r--views/mods/mod_productvariants/productTemplate.phtml38
-rw-r--r--views/produkt/addedit_price.phtml2
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('<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(),
+ '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
*/
-
+
?>
-<div class="wpsg_mod_variants_product_wrap">
+<div class="wpsg_mod_productvariants_product_wrap" id="wpsg_mod_productvariants_product_wrap_<?php echo $GLOBALS['wpsg_produkt_index']; ?>" wpsg-productindex="<?php echo $GLOBALS['wpsg_produkt_index']; ?>">
<?php foreach ($this->view['wpsg_mod_productvariants']['arVariants'] as $var) { ?>
- <div class="wpsg_mod_variants_product">
+ <div class=wpsg_mod_productvariants_product wpsg_mod_productvariants_type_<?php echo $var['type']; ?>">
+
+ <?php if ($var['type'] == wpsg_mod_productvariants::TYPE_SELECT) { ?>
+ <label class="wpsg_mod_productvariants_label" for="wpsg_mod_productvariants_<?php echo $this->view['wpsg_mod_productvariants']['product_id']; ?>_<?php echo $var['id']; ?>"><?php echo wpsg_hspc($var['name']); ?></label>
+
+ <select class="wpsg_mod_productvariants_change" id="wpsg_mod_productvariants_<?php echo $this->view['wpsg_mod_productvariants']['product_id']; ?>_<?php echo $var['id']; ?>" name="wpsg_mod_productvariants[<?php echo $var['id']; ?>]">
+ <?php foreach ($var['arVariation'] as $vari) { ?>
+ <option <?php echo (($this->view['wpsg_mod_productvariants']['product_variants'][$var['id']] == $vari['id'])?'selected="selected"':''); ?> value="<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['name']); ?></option>
+ <?php } ?>
+ </select>
+ <?php } else if ($var['type'] == wpsg_mod_productvariants::TYPE_RADIO) { ?>
+
+ <label class="wpsg_mod_productvariants_label"><?php echo wpsg_hspc($var['name']); ?></label>
+
+ <?php foreach ($var['arVariation'] as $vari) { ?>
+ <label class="wpsg_mod_productvariants_variation_label">
+ <input class="wpsg_mod_productvariants_change" <?php echo (($this->view['wpsg_mod_productvariants']['product_variants'][$var['id']] == $vari['id'])?'checked="checked"':''); ?> type="radio" name="wpsg_mod_productvariants[<?php echo $var['id']; ?>]" value="<?php echo $vari['id']; ?>" />
+ <span><?php echo wpsg_hspc($vari['name']); ?></span>
+ </label>
+ <?php } ?>
+
+ <?php } ?>
</div>
<?php } ?>
+
+ <script type="text/javascript">/* <![CDATA[ */
+
+ jQuery(document).ready(function() {
+
+ jQuery('#wpsg_mod_productvariants_product_wrap_<?php echo $GLOBALS['wpsg_produkt_index']; ?>').bind('change', wpsg_mod_productvariants_reload);
+
+ } );
+
+ /* ]]> */</script>
+
</div>
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 @@
<?php echo wpsg_drawForm_Select('mwst_key', __('Steuergruppe', 'wpsg'), wpsg_tax_groups(true), @$this->view['data']['mwst_key']); ?>
<?php echo wpsg_drawForm_Input('preis', wpsg_translate(__('Preis (#1#)', 'wpsg'), (($this->getBackendTaxview() === WPSG_NETTO)?'NETTO':'BRUTTO')), wpsg_ff($this->view['data']['preis'])); ?>
<?php echo wpsg_drawForm_Input('oldprice', wpsg_translate(__('Alter Preis (#1#)', 'wpsg'), (($this->getBackendTaxview() === WPSG_NETTO)?'NETTO':'BRUTTO')), wpsg_ff($this->view['data']['oldprice'])); ?>
- <?php echo wpsg_drawForm_Input('', __('Steueranteil', 'wpsg'), wpsg_ff(@$this->view['data']['tax_sum_value'], $this->get_option('wpsg_currency')).' / '.$this->getDefaultCountry()->kuerzel, array('text' => true)); ?>
+ <?php echo wpsg_drawForm_Text(__('Steueranteil', 'wpsg'), wpsg_ff(@$this->view['data']['tax_sum_value'], $this->get_option('wpsg_currency')).' / '.$this->getDefaultCountry()->kuerzel, array('text' => true)); ?>
<?php echo wpsg_drawForm_Checkbox('euleistungsortregel', __('Produkt unterliegt den EU-Leistungsortregeln', 'wpsg'), @$this->view['data']['euleistungsortregel'], array('fullrow' => true, 'help' => 'EU-Leistungsortregel')); ?>
<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=laender"><span class="glyphicon glyphicon-globe wpsg-glyphicon"></span><?php echo __('Länderverwaltung', 'wpsg'); ?></a>
<?php echo wpsg_drawForm_AdminboxEnd(); ?>