diff options
Diffstat (limited to 'views/mods/mod_orderupload/basket_after.phtml')
| -rw-r--r-- | views/mods/mod_orderupload/basket_after.phtml | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/views/mods/mod_orderupload/basket_after.phtml b/views/mods/mod_orderupload/basket_after.phtml new file mode 100644 index 0000000..a8b4a6e --- /dev/null +++ b/views/mods/mod_orderupload/basket_after.phtml @@ -0,0 +1,81 @@ +<?php
+
+ /**
+ * User: Daschmi (daschmi@daschmi.de)
+ * Date: 02.05.2018
+ * Time: 10:47
+ */
+
+?>
+
+<script>
+
+ function wpsg_mod_orderupload_upload(product_index, product_id) {
+
+ var files = document.getElementById('wpsg_mod_orderupload_' + product_index + '_file').files;
+ var formData = new FormData();
+
+ for (var i = 0; i < files.length; i++) {
+
+ var file = files[i];
+
+ formData.append('file[]', file, file.name);
+
+ }
+
+ formData.append('product_index', product_index);
+ formData.append('product_id', product_id);
+ formData.append('order_id', '<?php echo $_SESSION['wpsg']['order_id']; ?>');
+ formData.append('action', 'wpsg_mod_orderupload_upload');
+
+ var xhr = new XMLHttpRequest();
+
+ xhr.open('POST', wpsg_ajax.ajaxurl, true);
+
+ jQuery('#wpsg_mod_orderupload_' + product_index + '_target').html('<?php echo __('Bitte warten ', 'wpsg'); ?><img src="' + wpsg_ajax.img_ajaxloading + '" alt="' + wpsg_ajax.label_pleasewait + '" /></div>');
+
+ xhr.onload = function () {
+
+ if (xhr.status === 200) {
+
+ jQuery('#wpsg_mod_orderupload_' + product_index + '_target').html(xhr.responseText);
+
+ } else {
+
+ alert("<?php echo __('Fehler', 'wpsg'); ?>: " + xhr.responseText);
+
+ }
+
+ };
+
+ xhr.send(formData);
+
+ return false;
+
+ }
+
+ function wpsg_mod_orderupload_removefile(file, product_index, product_id) {
+
+ jQuery('#wpsg_mod_orderupload_' + product_index + '_target').html('<?php echo __('Bitte warten ', 'wpsg'); ?><img src="' + wpsg_ajax.img_ajaxloading + '" alt="' + wpsg_ajax.label_pleasewait + '" /></div>');
+
+ jQuery.ajax( {
+ url: wpsg_ajax.ajaxurl,
+ data: {
+ action: 'wpsg_mod_orderupload_delete',
+ order_id: <?php echo $_SESSION['wpsg']['order_id'] ?>,
+ product_index: product_index,
+ product_id: product_id,
+ file: file
+ },
+ success: function(data) {
+
+ jQuery('#wpsg_mod_orderupload_' + product_index + '_target').html(data);
+
+ }
+ } );
+
+ return false;
+
+ } // wpsg_mod_orderupload_removefile(aElement)
+
+</script>
|
