Subversion Repositories wpShopGermany4

Rev

Rev 7849 | Rev 7879 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5488 daniel 1
<?php
2
 
3
	/**
4
	 * Template um eine Variante zu bearbeiten
5
	 */
6
 
7
?>
7841 daniel 8
 
5488 daniel 9
<input type="hidden" id="wpsg_mod_productvariants_product_id" value="<?php echo $this->view['product_id']; ?>" />
10
<input type="hidden" id="wpsg_mod_productvariants_var_id" value="<?php echo $this->view['variant']['id']; ?>" />
11
 
7841 daniel 12
<script>
13
 
14
    var wpframe; var wpsg_mod_productvariants_vari_id = 0;
15
    var metaBox = jQuery('#meta-box-id.postbox');
16
 
17
    var addImgLink = metaBox.find('.upload-custom-img');
18
    var delImgLink = metaBox.find('.delete-custom-img');
19
    var imgContainer = metaBox.find('.custom-img-container');
20
    var imgIdInput = metaBox.find('.custom-img-id');
21
 
22
</script>
23
 
5488 daniel 24
<?php if (wpsg_isSizedArray($this->view['arVariation'])) { ?>
25
 
26
	<table class="table wpsg_mod_productvariants_table_variation">
27
    	<thead>
28
      		<tr>
29
 
6891 hartmut 30
      			<?php $colspan = 0; if (wpsg_isSizedInt($this->view['product_id'])) { ?>
6357 thomas 31
      			<th class="col_active"><?php echo __('Aktiv', 'wpsg'); ?></th>
7746 daniel 32
      		    <?php } ?>
33
 
5488 daniel 34
      			<th class="col_id"><?php echo __('Id', 'wpsg'); ?></th>
35
        		<th class="col1"><?php echo __('Name', 'wpsg'); ?></th>
5521 daniel 36
        		<th class="col_shortname"><?php echo __('Kurzname'); ?></th>
7746 daniel 37
      			<?php $colspan += 3; ?>
5488 daniel 38
 
6891 hartmut 39
        		<?php if (wpsg_isSizedInt($this->view['product_id'])) { $colspan += 2; ?>
5488 daniel 40
        		<th class="col_artnr"><?php echo __('Artikelnummer', 'wpsg'); ?></th>
41
        		<th class="col_price"><?php echo __('Preis', 'wpsg'); ?></th>
6193 hartmut 42
 
43
				<?php if ($this->hasMod('wpsg_mod_stock')) { ?>
6891 hartmut 44
        		<th class="col_stock"><?php echo __('Lagerbestand', 'wpsg'); $colspan ++; ?></th>
7096 florian 45
		        <th class="col_stock col_min_stock"><?php echo __('Minimallagerbestand', 'wpsg'); $colspan ++; ?></th>
46
		        <?php } ?>
6165 hartmut 47
 
48
				<?php if ($this->hasMod('wpsg_mod_weight')) { ?>
6891 hartmut 49
        		<th class="col_stock"><?php echo __('Gewicht', 'wpsg'); $colspan ++; ?></th>
5488 daniel 50
        		<?php } ?>
6193 hartmut 51
 
6165 hartmut 52
				<?php if ($this->hasMod('wpsg_mod_fuellmenge')) { ?>
6891 hartmut 53
        		<th class="col_stock"><?php echo __('Füllmenge', 'wpsg'); $colspan ++; ?></th>
6165 hartmut 54
        		<?php } ?>
5583 daniel 55
 
6165 hartmut 56
        		<?php } ?>
57
 
5583 daniel 58
		        <?php if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) { $colspan ++; ?>
59
			    <th class="col_action"></th>
60
		        <?php } ?>
5488 daniel 61
 
62
      		</tr>
7096 florian 63
    	</thead>
7841 daniel 64
    	<?php $i = 0; foreach ($this->view['arVariation'] as $vari) { $i ++;
65
 
66
		    $vari_id = intval($vari['id']);
67
 
68
	    ?>
5488 daniel 69
    	<tbody id="vari_<?php echo $vari['id']; ?>">
70
    		<tr>
71
 
72
    			<?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
73
    			<td class="col_active">
74
    				<input type="checkbox" id="productvariation_active_<?php echo $vari['id']; ?>" name="active" value="1" <?php echo ((wpsg_isSizedString($vari['active'], '1'))?'checked="checked"':''); ?> />
75
    			</td>
76
    			<?php } ?>
77
 
78
    			<td class="col_id">
79
    				<?php echo $vari['id']; ?>
80
    				<script type="text/javascript">/* <![CDATA[ */
81
 
5583 daniel 82
    					<?php if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) { ?>
5934 hartmut 83
						jQuery('#productvariation_name_<?php echo $vari['id']; ?>').wpsg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1', {
5488 daniel 84
							submitdata: {
85
					    		field: 'vari_name',
86
					    		field_id: '<?php echo $vari['id']; ?>'
87
							}
5521 daniel 88
						});
89
 
5934 hartmut 90
						jQuery('#productvariation_shortname_<?php echo $vari['id']; ?>').wpsg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1', {
5521 daniel 91
							submitdata: {
92
					    		field: 'vari_shortname',
93
					    		field_id: '<?php echo $vari['id']; ?>'
94
							}
5583 daniel 95
						});
96
					    <?php } ?>
5488 daniel 97
 
98
						jQuery('#productvariation_active_<?php echo $vari['id']; ?>').bind('change', function() {
99
 
100
							var value = '0';
101
							if (jQuery(this).prop('checked') === true) value = '1';
102
 
103
							jQuery.ajax( {
104
								url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1',
105
								data: {
106
									field: 'vari_active',
107
									field_id: '<?php echo $vari['id']; ?>',
108
									product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
109
									value: value
110
								}
111
							} );
112
 
113
						} );
114
 
5934 hartmut 115
						jQuery('#productvariation_anr_<?php echo $vari['id']; ?>').wpsg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1', {
5488 daniel 116
							submitdata: {
117
					    		field: 'vari_anr',
118
					    		product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
119
					    		field_id: '<?php echo $vari['id']; ?>'
120
							}
121
						});
122
 
5934 hartmut 123
						jQuery('#productvariation_price_<?php echo $vari['id']; ?>').wpsg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1', {
5488 daniel 124
							submitdata: {
125
					    		field: 'vari_price',
126
					    		product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
127
					    		field_id: '<?php echo $vari['id']; ?>'
128
							}
129
						});
130
 
5934 hartmut 131
						jQuery('#productvariation_stock_<?php echo $vari['id']; ?>').wpsg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1', {
5488 daniel 132
							submitdata: {
133
					    		field: 'vari_stock',
134
					    		product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
135
					    		field_id: '<?php echo $vari['id']; ?>'
136
							}
137
						});
5583 daniel 138
 
7096 florian 139
					    jQuery('#productvariation_min_stock_<?php echo $vari['id']; ?>').wpsg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1', {
140
						    submitdata: {
141
							    field: 'vari_min_stock',
142
							    product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
143
							    field_id: '<?php echo $vari['id']; ?>'
144
						    }
145
					    });
146
 
147
					    jQuery('#productvariation_weight_<?php echo $vari['id']; ?>').wpsg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1', {
6165 hartmut 148
							submitdata: {
149
					    		field: 'vari_weight',
150
					    		product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
151
					    		field_id: '<?php echo $vari['id']; ?>'
152
							}
153
						});
154
 
155
						jQuery('#productvariation_fmenge_<?php echo $vari['id']; ?>').wpsg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1', {
156
							submitdata: {
157
					    		field: 'vari_fmenge',
158
					    		product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
159
					    		field_id: '<?php echo $vari['id']; ?>'
160
							}
161
						});
162
 
5488 daniel 163
 
164
					/* ]]> */</script>
165
    			</td>
6149 hartmut 166
    			<td class="col1"><span class="wpsg_editable" id="productvariation_name_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['name']); ?></span>
167
    			<?php if (!isset($vari['iid'])) $vari['iid'] = $vari['id'];  ?>
168
    			<input type="hidden" id="productvariation_iid_<?php echo $vari['id']; ?>" value="<?php echo wpsg_getStr($vari['iid']); ?>" />
169
    			</td>
5521 daniel 170
    			<td class="col_shortname"><span class="wpsg_editable" id="productvariation_shortname_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['shortname']); ?></span></td>
5488 daniel 171
 
172
    			<?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
173
    			<td class="col_artnr"><span class="wpsg_editable" id="productvariation_anr_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['anr']); ?></span></td>
174
    			<td class="col_price"><span class="wpsg_editable" id="productvariation_price_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc(wpsg_ff($vari['price'], $this->get_option('wpsg_currency'))); ?></span></td>
7096 florian 175
 
6193 hartmut 176
				<?php if ($this->hasMod('wpsg_mod_stock')) { ?>
5488 daniel 177
    			<td class="col_stock"><span class="wpsg_editable" id="productvariation_stock_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['stock']); ?></span></td>
7096 florian 178
    			<td class="col_stock"><span class="wpsg_editable" id="productvariation_min_stock_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['min_stock']); ?></span></td>
6193 hartmut 179
        		<?php } ?>
6165 hartmut 180
 
181
				<?php if ($this->hasMod('wpsg_mod_weight')) { ?>
182
    			<td class="col_stock"><span class="wpsg_editable" id="productvariation_weight_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['weight']); ?></span></td>
183
        		<?php } ?>
184
				<?php if ($this->hasMod('wpsg_mod_fuellmenge')) { ?>
185
    			<td class="col_stock"><span class="wpsg_editable" id="productvariation_fmenge_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['fmenge']); ?></span></td>
186
        		<?php } ?>
187
 
5583 daniel 188
    			<?php } ?>
189
 
190
			    <?php if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) { ?>
191
				<td class="col_action">
5488 daniel 192
 
6454 hartmut 193
    				<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Variation löschen', 'wpsg'); ?>" onclick="return wpsg_mod_productvariation_del(<?php echo $this->view['product_id'].','.$vari['id']; ?>);"><span class="glyphicon glyphicon-trash"></span></a>
5488 daniel 194
 
195
    			</td>
5583 daniel 196
    			<?php } ?>
5488 daniel 197
 
198
    		</tr>
7841 daniel 199
 
6136 hartmut 200
    		<tr class="wpsg_mod_productvariants_productimage_row">
6891 hartmut 201
    			<td class="col_active">&nbsp;</td>
7851 daniel 202
   				<?php
7841 daniel 203
 
7851 daniel 204
                    $has_global_images = false;
205
 
7841 daniel 206
                    if (wpsg_isSizedInt($this->view['product_id'])) {
207
 
7851 daniel 208
                        $global_images = wpsg_explode(',', $this->db->fetchOne("SELECT `images` FROM `".WPSG_TBL_VARIANTS_VARI."` WHERE `id` = '".wpsg_q($vari['id'])."' "));
7841 daniel 209
 
7851 daniel 210
                        if (wpsg_isSizedArray($global_images)) {
211
 
212
                            $arAttachmentIDs = $global_images;
213
                            $has_global_images = true;
214
 
215
                        } else $arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['product_id'], $vari['id'], true, false);
216
 
7841 daniel 217
                    } else {
218
 
7842 daniel 219
                        $arAttachmentIDs = $vari['images'];
7841 daniel 220
 
221
                    }
7851 daniel 222
 
6136 hartmut 223
				?>
6438 daniel 224
				<td class="ui-sortable" colspan="<?php echo $colspan; ?>"  id="wpsg_images_productimage_<?php echo $this->view['variant']['id']; ?>_<?php echo $vari['id']; ?>" >
7841 daniel 225
 
226
                    <div class="d-flex justify-content-between w-100">
227
 
228
                        <div>
229
                            <?php foreach ($arAttachmentIDs as $attachment_id) { $attachment_id = intval($attachment_id); ?>
230
 
231
                                <?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
232
 
7851 daniel 233
                                    <?php if ($has_global_images) { ?>
234
 
7841 daniel 235
                                        <?php echo wp_get_attachment_image($attachment_id, array(25, 25), true); ?>
236
 
7851 daniel 237
                                    <?php } else { ?>
238
 
239
                                        <a href="#" class="<?php echo ((in_array($attachment_id, explode(",", $vari['images_set'])) && !$has_global_images)?'mark':''); ?> pic" id="<?php echo $attachment_id; ?>" onclick="return wpsg_vp_vari_setPic(this, <?php echo $this->view['variant']['id']; ?>, <?php echo $vari['id'] ?>, '<?php echo $attachment_id; ?>', <?php echo $this->view['product_id']; ?>);">
240
                                            <?php echo wp_get_attachment_image($attachment_id, array(25, 25), true); ?>
241
                                        </a>
242
 
243
                                    <?php } ?>
244
 
7841 daniel 245
                                <?php } else { ?>
246
 
247
                                    <a href="#" class="pic wpsg_mod_productvariants_remove_global_vari_image"
248
                                        data-variant_id="<?php echo intval($_REQUEST['variant_id']); ?>"
249
                                        data-variation_id="<?php echo $vari['id']; ?>"
250
                                        data-attachment_id="<?php echo $attachment_id; ?>"
251
                                    >
252
                                        <?php echo wp_get_attachment_image($attachment_id, array(25, 25), true); ?>
253
                                        <span><span class="glyphicon glyphicon-trash"></span></span>
254
                                    </a>
255
 
256
                                <?php } ?>
257
 
258
                            <?php } ?>
259
                        </div>
260
 
261
                        <?php if (!wpsg_isSizedInt($this->view['product_id'])) { ?>
262
                        <div>
263
 
264
                            <input id="media_upload_<?php echo $vari['id']; ?>" value="<?php echo __('Mediathek', 'wpsg'); ?>" class="button" type="button" />
265
 
266
                        </div>
267
                        <?php } ?>
268
 
269
                    </div>
7849 daniel 270
 
271
                    <?php if ($this->hasMod('wpsg_mod_downloadplus')) { ?>
272
                    <div>
273
 
274
                        <?php
275
 
276
                            $arTemplates = $this->callMod('wpsg_mod_downloadplus', 'getTemplate', []);
277
                            $arTemplatesLabel = [
278
 
279
                            ];
280
 
281
                            foreach ($arTemplates as $t) $arTemplatesLabel[intval($t['id'])] = $t['name'];
282
 
283
                        ?>
284
 
285
                        <span title="<?php echo __('Templatevorgabe für PDF Anpassungen mit DownloadPlus', 'wpsg'); ?>" class="wpsg_editable" id="productvariation_template_<?php echo $vari['id']; ?>"><?php
286
 
287
                            $template_id = intval($vari['template_id']);
288
 
289
                            if ($template_id > 0 && isset($arTemplatesLabel[$template_id])) echo $arTemplatesLabel[$template_id];
290
                            else __('Unverändert', 'wpsg');
291
 
292
                        ?></span>
293
 
294
                        <script>
295
 
296
                            jQuery('#productvariation_template_<?php echo $vari['id']; ?>').wpsg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1', {
297
                                submitdata: {
298
                                    field: 'template_id',
299
                                    field_id: '<?php echo $vari['id']; ?>'
300
                                },
301
                                data: <?php echo wpsg_prepare_for_inlineEdit($arTemplatesLabel); ?>,
302
                                type: 'select'
303
                            });
304
 
305
                        </script>
306
 
307
                    </div>
308
                    <?php } ?>
6094 hartmut 309
 
7841 daniel 310
					<script>
6136 hartmut 311
 
6438 daniel 312
						jQuery(document).ready(function() {
7841 daniel 313
 
314
							<?php if (intval($this->view['product_id']) <= 0) { ?>
315
							document.getElementById('media_upload_<?php echo $vari['id']; ?>').addEventListener('click', (event) => {
316
 
317
								event.preventDefault();
318
 
319
								wpsg_mod_productvariants_vari_id = <?php echo $vari['id']; ?>;
320
 
321
								if (wpframe !== undefined) { wpframe.open(); return; }
322
 
323
								wpframe = wp.media.frames.file_frame = wp.media({
324
                                    title: "<?php echo __('Auswählen oder Hochladen von Medien', 'wpsg'); ?>",
325
                                    button: { text: "<?php echo __('Medien benutzen', 'wpsg'); ?>" },
326
                                    multiple: true
327
					            });
328
 
329
								wpframe.on('select', () => {
330
 
331
									let arAtt = [];
332
				                    let attachments = wpframe.state().get('selection').map((attachment) => {
333
 
334
                                        attachment.toJSON();
335
 
336
                                        arAtt.push(attachment.id);
337
 
338
                                        return attachment;
339
 
340
				                    });
341
 
342
				                    jQuery('#wpsg_mod_productvariants_dialog_modal .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
343
 
344
				                    jQuery.ajax({
345
                                        url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_upload&noheader=1',
346
                                        async: true,
347
                                        data: {
348
                                            product_id: '<?php echo intval($_REQUEST['product_id']); ?>',
349
                                            variant_id: '<?php echo intval($_REQUEST['variant_id']); ?>',
350
                                            vari_id: wpsg_mod_productvariants_vari_id,
351
                                            arAtt: arAtt
352
                                        },
353
                                        success: function(data) {
354
 
355
                                            jQuery('#wpsg_mod_productvariants_dialog_modal .modal-body').html(data);
356
 
357
                                        }
358
                                    });
359
 
360
                                });
361
 
362
								wpframe.open();
363
 
364
                            });
365
							<?php } ?>
366
 
367
							<?php if (intval($this->view['product_id']) > 0) { ?>
6438 daniel 368
					   		jQuery('#wpsg_images_productimage_<?php echo $this->view['variant']['id']; ?>_<?php  echo $vari['id']; ?>').sortable( {
6136 hartmut 369
								items: 'a',
370
								helper : 'clone',
371
								update: function(event, ui) {
372
 
373
									wpsg_vp_ajaxloading_show();
374
 
375
									var wpsg_reorder = jQuery(this).sortable('toArray');
6438 daniel 376
 
6136 hartmut 377
									jQuery.ajax( {
378
										url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_productvariants&cmd=wpsg_var_setImageOrder&noheader=1&edit_id=<?php echo $this->view['product_id']; ?>',
379
										async: false,
380
										data: {
6438 daniel 381
											'var_id': <?php echo $this->view['variant']['id']; ?>,
382
											'vari_id': <?php echo $vari['id']; ?>,
6136 hartmut 383
											'wpsg_reorder': wpsg_reorder
384
										},
385
										success: function(data) {
386
 
387
											if (data != '1') alert(data);
6438 daniel 388
 
6136 hartmut 389
											wpsg_vp_ajaxloading_hide();
390
 
391
										}
392
									} );
393
 
394
								}
7841 daniel 395
							} ).disableSelection();
396
					   		<?php } ?>
6136 hartmut 397
 
398
			   			} );
399
 
6438 daniel 400
					</script>
401
 
402
				</td>
403
 
5488 daniel 404
    		</tr>
5490 daniel 405
 
5488 daniel 406
    	</tbody>
407
    	<?php } ?>
408
 
409
    </table>
410
 
7841 daniel 411
	<script>
5488 daniel 412
 
6438 daniel 413
	function wpsg_vp_vari_setPic(htmlElement, var_id, vari_id, attachment_id, product_id)
6094 hartmut 414
	{
415
 
416
		<?php if (!isset($_REQUEST['wpsg_lang'])) { ?>
417
 
418
		wpsg_vp_ajaxloading_show();
6438 daniel 419
 
6094 hartmut 420
		jQuery.ajax( {
421
			url: "<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_productvariants&cmd=wpsg_vp_vari_setPic&noheader=1&edit_id=<?php echo $this->view['product_id']; ?>",
422
			async: false,
423
			data: {
424
				var_id: var_id,
425
				vari_id: vari_id,
6438 daniel 426
				product_id: product_id,
427
				attachment_id: attachment_id
6094 hartmut 428
			},
429
			success: function(data) {
6438 daniel 430
 
431
				jQuery(htmlElement).toggleClass('mark');
432
 
6094 hartmut 433
				wpsg_vp_ajaxloading_hide();
434
 
435
			}
436
		} );
437
 
438
		<?php } ?>
439
 
440
		return false;
441
 
442
	}
443
 
444
	function wpsg_vp_ajaxloading_show()
445
	{
446
 
6136 hartmut 447
		jQuery('.wpsg_mod_productvariants_ajaxloading').show();
6094 hartmut 448
 
449
	}
450
 
451
	function wpsg_vp_ajaxloading_hide()
452
	{
453
 
6136 hartmut 454
		jQuery('.wpsg_mod_productvariants_ajaxloading').hide();
6094 hartmut 455
 
456
	}
457
 
458
 
6149 hartmut 459
		<?php
460
			$b1 = wpsg_isSizedInt($this->view['product_id']);
461
			$b2 = wpsg_isSizedInt($this->view['variant']['product_id']);
462
			if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) {
6094 hartmut 463
		?>
6149 hartmut 464
			<?php
465
				$p1 = wpsg_getInt($this->view['product_id']);
466
				$p2 = ($this->view['variant']['product_id']);
467
			?>
5488 daniel 468
 
469
		jQuery('.wpsg_mod_productvariants_table_variation').sortable( {
470
			items: 'tbody',
471
			helper: wpsg_Tablefix,
472
			update: function(event, ui) {
473
 
474
				var wpsg_reorder = jQuery(this).sortable('toArray');
475
				var product_id = jQuery('#wpsg_mod_productvariants_product_id').val();
6149 hartmut 476
 
5488 daniel 477
				jQuery.ajax( {
478
					url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1',
479
					data: {
480
						'field': 'vari_pos',
481
						'value': jQuery(this).sortable('toArray'),
482
						'product_id': product_id
483
					},
484
					success: function(data) { }
485
				} );
486
 
487
			}
488
		} ).disableSelection();
489
 
490
		<?php } ?>
491
 
492
		<?php if (wpsg_isSizedInt($this->view['variant']['product_id']) || !wpsg_isSizedInt($this->view['product_id'])) { ?>
493
		jQuery('#wpsg_mod_productvariants_variation_add_button').show();
494
		<?php } else { ?>
495
		jQuery('#wpsg_mod_productvariants_variation_add_button').hide();
496
		<?php } ?>
7841 daniel 497
 
498
        jQuery('.wpsg_mod_productvariants_remove_global_vari_image').on('click', function() {
499
 
500
            let el = jQuery(this);
501
 
502
            event.preventDefault();
503
 
504
            if (!confirm('<?php echo __('Sind Sie sich sicher?', 'wpsg'); ?>')) return;
505
 
506
            el.remove();
507
 
508
            jQuery.ajax({
509
                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_removeImage&noheader=1',
510
                async: true,
511
                data: {
512
                    product_id: 0,
513
                    variant_id: el.data('variant_id'),
514
                    vari_id: el.data('variation_id'),
515
                    attachment_id: el.data('attachment_id')
516
                },
517
                success: function(data) { }
518
            });
519
 
520
        });
521
 
522
	</script>
7849 daniel 523
 
5488 daniel 524
    <?php if (!wpsg_isSizedInt($this->view['product_id'])) { ?>
525
    <p class="wpsg_hinweis"><?php echo __('Reihenfolge kann mittels Drag&Drop verändert werden.', 'wpsg'); ?></p>
526
    <?php } ?>
527
 
528
<?php } else { ?>
5583 daniel 529
 
530
	<?php echo __('Bisher keine Variationen der Variante angelegt.', 'wpsg'); ?>
531
 
7841 daniel 532
	<script>
5583 daniel 533
 
534
		<?php if (wpsg_isSizedInt($this->view['variant']['product_id']) || !wpsg_isSizedInt($this->view['product_id'])) { ?>
535
			jQuery('.wpsg_mod_productvariants_variation_add_button').show();
536
		<?php } else { ?>
537
			jQuery('.wpsg_mod_productvariants_variation_add_button').hide();
538
		<?php } ?>
539
 
7841 daniel 540
    </script>
5583 daniel 541
 
7841 daniel 542
<?php } ?>
543