diff options
Diffstat (limited to 'views/mods/mod_scaleprice')
| -rw-r--r-- | views/mods/mod_scaleprice/product_bottom.phtml | 45 | ||||
| -rw-r--r-- | views/mods/mod_scaleprice/produkt_edit_sidebar.phtml | 202 | ||||
| -rw-r--r-- | views/mods/mod_scaleprice/scaleList.phtml | 84 |
3 files changed, 331 insertions, 0 deletions
diff --git a/views/mods/mod_scaleprice/product_bottom.phtml b/views/mods/mod_scaleprice/product_bottom.phtml new file mode 100644 index 0000000..44618d0 --- /dev/null +++ b/views/mods/mod_scaleprice/product_bottom.phtml @@ -0,0 +1,45 @@ +<?php
+
+ /**
+ * Template für die Integration der Staffelanzeige in das Produkttemplate
+ * Muss in den Darstellungsoptionen aktiviert werden
+ */
+
+?>
+<div class="wpsg_mod_scaleprice_producttemplate">
+ <?php if ($this->view['wpsg_mod_scaleprice']['typ'] == wpsg_mod_scaleprice::TYP_QUANTITY) { ?>
+ <?php echo __('Das Produkt hat einen gestaffelten Preis, dieser ergibt sich Anhand der Menge wie folgt:', 'wpsg'); ?><br />
+ <?php } else if ($this->view['wpsg_mod_scaleprice']['typ'] == wpsg_mod_scaleprice::TYP_WEIGHT) { ?>
+ <?php echo __('Das Produkt hat einen gestaffelten Preis, dieser ergibt sich Anhand des Gewichts wie folgt:', 'wpsg'); ?><br />
+ <?php } ?>
+ <ul>
+
+ <?php if ($this->view['wpsg_mod_scaleprice']['typ'] != wpsg_mod_scaleprice::TYP_QUANTITY || $this->view['wpsg_mod_scaleprice']['scale'][0]['scale'] != '1') { ?>
+ <li>
+ <?php echo __('Bis ', 'wpsg'); ?>
+ <?php if ($this->view['wpsg_mod_scaleprice']['typ'] == wpsg_mod_scaleprice::TYP_QUANTITY) { ?>
+ <?php echo wpsg_ff($this->view['wpsg_mod_scaleprice']['scale'][0]['scale'], __('Stück', 'wpsg')); ?>
+ <?php } else if ($this->view['wpsg_mod_scaleprice']['typ'] == wpsg_mod_scaleprice::TYP_WEIGHT) { ?>
+ <?php echo wpsg_ff($this->view['wpsg_mod_scaleprice']['scale'][0]['scale'], $this->get_option('wpsg_mod_weight_unit')); ?>
+ <?php } ?>
+ <?php echo __(' kostet das Produkt ', 'wpsg'); ?>
+ <?php echo wpsg_ff($this->view['wpsg_mod_scaleprice']['base'], $this->get_option('wpsg_currency')); ?> <?php echo __('je Stück', 'wpsg'); ?>
+ <?php $this->callMod('wpsg_mod_fuellmenge', 'renderPriceInfo', array($this->view['wpsg_mod_scaleprice']['base'], $this->view['data']['fmenge'], $this->view['data']['feinheit'])); ?>
+ </li>
+ <?php } ?>
+
+ <?php foreach ((array)$this->view['wpsg_mod_scaleprice']['scale'] as $scale) { ?>
+ <li>
+ <?php echo __('Ab ', 'wpsg'); ?>
+ <?php if ($this->view['wpsg_mod_scaleprice']['typ'] == wpsg_mod_scaleprice::TYP_QUANTITY) { ?>
+ <?php echo wpsg_ff($scale['scale'], __('Stück', 'wpsg')); ?>
+ <?php } else if ($this->view['wpsg_mod_scaleprice']['typ'] == wpsg_mod_scaleprice::TYP_WEIGHT) { ?>
+ <?php echo wpsg_ff($scale['scale'], $this->get_option('wpsg_mod_weight_unit')); ?>
+ <?php } ?>
+ <?php echo __(' kostet das Produkt ', 'wpsg'); ?>
+ <?php echo wpsg_ff($scale['value'], $this->get_option('wpsg_currency')); ?> <?php echo __('je Stück', 'wpsg'); ?>
+ <?php $this->callMod('wpsg_mod_fuellmenge', 'renderPriceInfo', array($scale['value'], $this->view['data']['fmenge'] , $this->view['data']['feinheit'])); ?>
+ </li>
+ <?php } ?>
+ </ul>
+</div>
\ No newline at end of file diff --git a/views/mods/mod_scaleprice/produkt_edit_sidebar.phtml b/views/mods/mod_scaleprice/produkt_edit_sidebar.phtml new file mode 100644 index 0000000..f220dc1 --- /dev/null +++ b/views/mods/mod_scaleprice/produkt_edit_sidebar.phtml @@ -0,0 +1,202 @@ +<?php
+
+ /**
+ * Template für die Integration der Staffelpreise in die Produktverwaltung
+ */
+
+?>
+<script type="text/javascript">/* <![CDATA[ */ +
+ jQuery(document).ready(function() {
+
+ jQuery('#wpsg_mod_scaleprice_activ').bind('change', function() {
+
+ if (jQuery(this).attr('checked') == 'checked') jQuery('#wpsg_mod_scaleprice_layer').show();
+ else jQuery('#wpsg_mod_scaleprice_layer').hide();
+
+ } ).change();
+
+ jQuery('#wpsg_mod_scaleprice_typ').bind('change', function() { wpsg_mod_scaleprice_refresh(); } );
+ jQuery('#wpsg_mod_scaleprice_calc').bind('change', function() { wpsg_mod_scaleprice_saveAjax(); } );
+
+ <?php /* echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_downloadprodukte&edit_id=<?php echo $this->view['data']['id'] ?>&noheader=1&cmd=upload_file*/?>
+
+ } );
+
+ function wpsg_mod_scaleprice_add()
+ {
+
+ var wpsg_scale = jQuery('#wpsg_mod_scaleprice_scale').val();
+ var wpsg_value = jQuery('#wpsg_mod_scaleprice_value').val();
+
+ jQuery('#wpsg_mod_scaleprice_target').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+
+ jQuery.ajax( {
+ url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_scaleprice&edit_id=<?php echo $this->view['wpsg_mod_scaleprice']['product']['id']; ?>&noheader=1&cmd=add',
+ data: {
+ 'scale': wpsg_scale,
+ 'value': wpsg_value
+ },
+ success: function(data) {
+
+ jQuery('#wpsg_mod_scaleprice_target').html(data);
+ wpsg_mod_scaleprice_clearErrorField();
+
+ }
+ } );
+
+ return false;
+
+ } // function wpsg_mod_scaleprice_add()
+
+ function wpsg_mod_scaleprice_refresh()
+ {
+
+ jQuery('#wpsg_mod_scaleprice_target').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+
+ jQuery.ajax( {
+ url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_scaleprice&edit_id=<?php echo $this->view['wpsg_mod_scaleprice']['product']['id']; ?>&noheader=1&cmd=refresh',
+ data: {
+ typ: jQuery('#wpsg_mod_scaleprice_typ').val(),
+ calc: jQuery('#wpsg_mod_scaleprice_calc').val()
+ },
+ success: function(data) {
+
+ jQuery('#wpsg_mod_scaleprice_target').html(data);
+ wpsg_mod_scaleprice_clearErrorField();
+
+ }
+ } );
+
+ return false;
+
+ } // function wpsg_mod_scaleprice_refresh()
+
+ function wpsg_mod_scaleprice_saveAjax()
+ {
+
+ jQuery.ajax( {
+ url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_scaleprice&edit_id=<?php echo $this->view['wpsg_mod_scaleprice']['product']['id']; ?>&noheader=1&cmd=ajaxSave',
+ data: {
+ typ: jQuery('#wpsg_mod_scaleprice_typ').val(),
+ calc: jQuery('#wpsg_mod_scaleprice_calc').val()
+ },
+ success: function(data) {
+
+ wpsg_mod_scaleprice_clearErrorField();
+
+ }
+ } );
+
+ } // function wpsg_mod_scaleprice_saveAjax()
+
+ function wpsg_mod_scaleprice_clearErrorField()
+ {
+
+ var wpsg_product_edit_change_new = Array();
+
+ for (var i = 0; i < wpsg_product_edit_change.length; i++)
+ {
+
+ if (!wpsg_product_edit_change[i].match(/^wpsg_mod_scaleprice/))
+ {
+
+ wpsg_product_edit_change_new.push(wpsg_product_edit_change[i]);
+
+ }
+
+ }
+
+ wpsg_product_edit_change = wpsg_product_edit_change_new;
+
+ }
+
+ function wpsg_mod_scaleprice_change(ev)
+ {
+
+ if (!wpsg_in_array(ev.target.id, wpsg_product_edit_change) && jQuery(ev.target).val() != "")
+ {
+
+ wpsg_product_edit_change.push(ev.target.id);
+
+ }
+ else if (jQuery(ev.target).val() == "" && wpsg_in_array(ev.target.id, wpsg_product_edit_change))
+ {
+
+ for (var i = 0; i < wpsg_product_edit_change.length; i++)
+ {
+
+ if (wpsg_product_edit_change[i] == ev.target.id)
+ {
+
+ wpsg_product_edit_change.splice(i, 1);
+ jQuery('#' + ev.target.id).removeClass('wpsg_change_error');
+
+ }
+
+ }
+
+ }
+
+ } // function wpsg_mod_scaleprice_change(ev)
+
+ function wpsg_mod_scaleprice_remove(scale_id)
+ {
+
+ if (!confirm('<?php echo __('Sind Sie sich sicher, dass sie diese Staffel entfernen möchten?', 'wpsg'); ?>')) return false;
+
+ jQuery.ajax( {
+ url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_scaleprice&edit_id=<?php echo $this->view['wpsg_mod_scaleprice']['product']['id']; ?>&noheader=1&cmd=remove',
+ data: {
+ scale_id: scale_id
+ },
+ success: function(data) {
+
+ jQuery('#wpsg_mod_scaleprice_row_' + scale_id).remove();
+
+ }
+ } );
+
+ return false;
+
+ } // function wpsg_mod_scaleprice_remove(scale_id)
+ +/* ]]> */</script>
+
+<div class="postbox" id="wpsg_scaleprice">
+ <h3 class="wpsg_handlediv">
+ <span title="<?php echo __('Zum Ein/Ausklappen hier klicken', 'wpsg'); ?>" class="handlediv"><br /></span>
+ <span><?php echo __('Staffelpreise', 'wpsg'); ?></span>
+ </h3>
+ <div class="inside">
+
+ <?php if ($this->view['wpsg_mod_scaleprice']['product']['id'] <= 0) { ?>
+ <p><?php echo __('Staffelpreise können erst nach einmaligem Speichern des Produktes definiert werden.', 'wpsg'); ?>
+ <?php } else { ?>
+
+ <?php echo wpsg_drawForm_Checkbox('wpsg_mod_scaleprice_activ', __('Staffelpreise aktiv', 'wpsg'), $this->view['wpsg_mod_scaleprice']['product']['wpsg_mod_scaleprice_activ']); ?>
+
+ <div id="wpsg_mod_scaleprice_layer">
+
+ <?php if (wpsg_isSizedArray($this->view['wpsg_mod_scaleprice']['arTyp']) && sizeof($this->view['wpsg_mod_scaleprice']['arTyp']) > 0) { ?>
+ <?php echo wpsg_drawForm_Select('wpsg_mod_scaleprice_typ', __('Bezugsgröße', 'wpsg'), array(
+ wpsg_mod_scaleprice::TYP_QUANTITY => __('Menge', 'wpsg'),
+ wpsg_mod_scaleprice::TYP_WEIGHT => __('Gewicht', 'wpsg')
+ ), $this->view['wpsg_mod_scaleprice']['product']['wpsg_mod_scaleprice_typ']); ?>
+ <?php } else { ?>
+ <input type="hidden" name="wpsg_mod_scaleprice_typ" id="wpsg_mod_scaleprice_typ" value="0" />
+ <?php } ?>
+
+ <?php echo wpsg_drawForm_Select('wpsg_mod_scaleprice_calc', __('Berechnung', 'wpsg'), array(
+ wpsg_mod_scaleprice::CALC_REPLACE => __('Ersetzung', 'wpsg'),
+ wpsg_mod_scaleprice::CALC_ADD => __('Addition', 'wpsg')
+ ), $this->view['wpsg_mod_scaleprice']['product']['wpsg_mod_scaleprice_calc']); ?>
+
+ <div id="wpsg_mod_scaleprice_target"><?php echo $this->view['wpsg_mod_scaleprice']['list']; ?></div>
+
+ </div>
+
+ <?php } ?>
+
+ </div>
+</div>
\ No newline at end of file diff --git a/views/mods/mod_scaleprice/scaleList.phtml b/views/mods/mod_scaleprice/scaleList.phtml new file mode 100644 index 0000000..f08aaf9 --- /dev/null +++ b/views/mods/mod_scaleprice/scaleList.phtml @@ -0,0 +1,84 @@ +<?php
+
+ /**
+ * Template für die Liste der Staffelpreise innerhalb der Produktverwaltung
+ */
+
+?>
+<?php foreach ((array)$this->view['wpsg_mod_scaleprice']['arScale'] as $k => $scale) { ?>
+<div class="wpsg_form_field wpsg_mod_scaleprice_row" id="wpsg_mod_scaleprice_row_<?php echo $scale['id']; ?>">
+ <div class="wpsg_form_left">
+ <div class="wpsg_mod_scaleprice_label_scale"><?php echo __('ab', 'wpsg'); ?></div>
+ <div class="wpsg_editable" id="wpsg_mod_scaleprice_<?php echo $scale['id']; ?>_scale"><?php echo wpsg_ff($scale['scale']); ?></div>
+ <div class="wpsg_mod_scaleprice_label_value">
+ <?php if ($this->view['wpsg_mod_scaleprice']['typ'] == wpsg_mod_scaleprice::TYP_WEIGHT) { ?>
+ <?php echo $this->get_option('wpsg_mod_weight_unit'); ?>
+ <?php } else if ($this->view['wpsg_mod_scaleprice']['typ'] == wpsg_mod_scaleprice::TYP_QUANTITY) { ?>
+ <?php echo __('Stück', 'wpsg'); ?>
+ <?php } ?>
+ </div>
+ </div>
+ <div class="wpsg_form_right">
+ <div class="wpsg_editable" id="wpsg_mod_scaleprice_<?php echo $scale['id']; ?>_value"><?php echo wpsg_ff($scale['value']); ?></div>
+ <p class="waehrung"><?php echo $this->get_option('wpsg_currency'); ?></p>
+ <a class="wpsg_icon wpsg_icon_right wpsg_icon_remove" href="" onclick="return wpsg_mod_scaleprice_remove(<?php echo $scale['id']; ?>);" title=""></a>
+ </div>
+ <div class="wpsg_clear"></div>
+</div>
+
+<script type="text/javascript">
+/* <![CDATA[ */ +
+ jQuery(document).ready(function() {
+
+ jQuery('#wpsg_mod_scaleprice_<?php echo $scale['id']; ?>_scale').editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_scaleprice&edit_id=<?php echo $this->view['wpsg_mod_scaleprice']['product']['id']; ?>&noheader=1&cmd=inlineEdit', {
+ submitdata: {
+ field: 'scale',
+ scale_id: '<?php echo $scale['id']; ?>'
+ },
+ submit: '<?php echo __('Speichern', 'wpsg'); ?>',
+ placeholder: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
+ indicator: '<?php echo __('Speicher ...', 'wpsg'); ?>',
+ tooltip: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>'
+ });
+
+ jQuery('#wpsg_mod_scaleprice_<?php echo $scale['id']; ?>_value').editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_scaleprice&edit_id=<?php echo $this->view['wpsg_mod_scaleprice']['product']['id']; ?>&noheader=1&cmd=inlineEdit', {
+ submitdata: {
+ field: 'value',
+ scale_id: '<?php echo $scale['id']; ?>'
+ },
+ submit: '<?php echo __('Speichern', 'wpsg'); ?>',
+ placeholder: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
+ indicator: '<?php echo __('Speicher ...', 'wpsg'); ?>',
+ tooltip: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>'
+ });
+
+ jQuery('#wpsg_mod_scaleprice_scale').bind('blur', wpsg_mod_scaleprice_change);
+ jQuery('#wpsg_mod_scaleprice_value').bind('blur', wpsg_mod_scaleprice_change);
+
+ } );
+ +/* ]]> */
+</script>
+
+<?php } ?>
+
+<div class="wpsg_form_field">
+ <div class="wpsg_form_left">
+ <div class="wpsg_mod_scaleprice_label_scale"><?php echo __('ab', 'wpsg'); ?></div>
+ <input type="text" class="wpsg_mod_scaleprice_scale" name="wpsg_mod_scaleprice_scale" value="" id="wpsg_mod_scaleprice_scale" />
+ <div class="wpsg_mod_scaleprice_label_value">
+ <?php if ($this->view['wpsg_mod_scaleprice']['typ'] == wpsg_mod_scaleprice::TYP_WEIGHT) { ?>
+ <?php echo $this->get_option('wpsg_mod_weight_unit'); ?>
+ <?php } else if ($this->view['wpsg_mod_scaleprice']['typ'] == wpsg_mod_scaleprice::TYP_QUANTITY) { ?>
+ <?php echo __('Stück', 'wpsg'); ?>
+ <?php } ?>
+ </div>
+ </div>
+ <div class="wpsg_form_right">
+ <input type="text" class="wpsg_mod_scaleprice_value" name="wpsg_mod_scaleprice_value" value="" id="wpsg_mod_scaleprice_value">
+ <p class="waehrung"><?php echo $this->get_option('wpsg_currency'); ?></p>
+ <a class="wpsg_icon wpsg_icon_right wpsg_icon_add" href="" onclick="return wpsg_mod_scaleprice_add();" title=""></a>
+ </div>
+ <div class="wpsg_clear"></div>
+</div>
\ No newline at end of file |
