summaryrefslogtreecommitdiff
path: root/views/mods
diff options
context:
space:
mode:
Diffstat (limited to 'views/mods')
-rw-r--r--views/mods/mod_productvariants/frontend.js25
-rw-r--r--views/mods/mod_productvariants/productTemplate.phtml38
2 files changed, 60 insertions, 3 deletions
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>