Subversion Repositories wpShopGermany4

Rev

Rev 7851 | Rev 8251 | 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
 
7879 daniel 307
                        <?php if (intval($this->view['product_id']) <= 0) { ?>
308
                        <span style="padding-left:15px;">
309
                            <span style="display:inline-block; margin-right:5px;"><?php echo __('Für alle Downloadplus Produkte:', 'wpsg'); ?></span>
310
                            <a onclick="return wpsg_mod_downloadplus_setProducts(<?php echo $vari['id']; ?>, '1');" href="#" style="display:inline-block;"><?php echo __('aktivieren', 'wpsg'); ?></a>
311
                            <span style="margin:0 3px; text-align:center;">/</span>
312
                            <a onclick="return wpsg_mod_downloadplus_setProducts(<?php echo $vari['id']; ?>, '0');" href="#" style="display:inline-block;"><?php echo __('deaktivieren', 'wpsg'); ?></a>
313
                        </span>
314
                        <?php } ?>
315
 
7849 daniel 316
                    </div>
317
                    <?php } ?>
6094 hartmut 318
 
7841 daniel 319
					<script>
6136 hartmut 320
 
7879 daniel 321
                        function wpsg_mod_downloadplus_setProducts(vari_id, active) {
322
 
323
                        	jQuery.ajax( {
324
                                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_wpsg_mod_downloadplus_setProducts&noheader=1',
325
                                async: false,
326
                                data: {
327
                                    vari_id: vari_id,
328
                                    active: active
329
                                },
330
                                success: function(data) {
331
 
332
                                    if (data != '1') alert(data);
333
 
334
                                }
335
                            } );
336
 
337
                        	return false;
338
 
339
                        }
340
 
6438 daniel 341
						jQuery(document).ready(function() {
7841 daniel 342
 
343
							<?php if (intval($this->view['product_id']) <= 0) { ?>
344
							document.getElementById('media_upload_<?php echo $vari['id']; ?>').addEventListener('click', (event) => {
345
 
346
								event.preventDefault();
347
 
348
								wpsg_mod_productvariants_vari_id = <?php echo $vari['id']; ?>;
349
 
350
								if (wpframe !== undefined) { wpframe.open(); return; }
351
 
352
								wpframe = wp.media.frames.file_frame = wp.media({
353
                                    title: "<?php echo __('Auswählen oder Hochladen von Medien', 'wpsg'); ?>",
354
                                    button: { text: "<?php echo __('Medien benutzen', 'wpsg'); ?>" },
355
                                    multiple: true
356
					            });
357
 
358
								wpframe.on('select', () => {
359
 
360
									let arAtt = [];
361
				                    let attachments = wpframe.state().get('selection').map((attachment) => {
362
 
363
                                        attachment.toJSON();
364
 
365
                                        arAtt.push(attachment.id);
366
 
367
                                        return attachment;
368
 
369
				                    });
370
 
371
				                    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'); ?>" />');
372
 
373
				                    jQuery.ajax({
374
                                        url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_upload&noheader=1',
375
                                        async: true,
376
                                        data: {
377
                                            product_id: '<?php echo intval($_REQUEST['product_id']); ?>',
378
                                            variant_id: '<?php echo intval($_REQUEST['variant_id']); ?>',
379
                                            vari_id: wpsg_mod_productvariants_vari_id,
380
                                            arAtt: arAtt
381
                                        },
382
                                        success: function(data) {
383
 
384
                                            jQuery('#wpsg_mod_productvariants_dialog_modal .modal-body').html(data);
385
 
386
                                        }
387
                                    });
388
 
389
                                });
390
 
391
								wpframe.open();
392
 
393
                            });
394
							<?php } ?>
395
 
396
							<?php if (intval($this->view['product_id']) > 0) { ?>
6438 daniel 397
					   		jQuery('#wpsg_images_productimage_<?php echo $this->view['variant']['id']; ?>_<?php  echo $vari['id']; ?>').sortable( {
6136 hartmut 398
								items: 'a',
399
								helper : 'clone',
400
								update: function(event, ui) {
401
 
402
									wpsg_vp_ajaxloading_show();
403
 
404
									var wpsg_reorder = jQuery(this).sortable('toArray');
6438 daniel 405
 
6136 hartmut 406
									jQuery.ajax( {
407
										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']; ?>',
408
										async: false,
409
										data: {
6438 daniel 410
											'var_id': <?php echo $this->view['variant']['id']; ?>,
411
											'vari_id': <?php echo $vari['id']; ?>,
6136 hartmut 412
											'wpsg_reorder': wpsg_reorder
413
										},
414
										success: function(data) {
415
 
416
											if (data != '1') alert(data);
6438 daniel 417
 
6136 hartmut 418
											wpsg_vp_ajaxloading_hide();
419
 
420
										}
421
									} );
422
 
423
								}
7841 daniel 424
							} ).disableSelection();
425
					   		<?php } ?>
6136 hartmut 426
 
427
			   			} );
428
 
6438 daniel 429
					</script>
430
 
431
				</td>
432
 
5488 daniel 433
    		</tr>
5490 daniel 434
 
5488 daniel 435
    	</tbody>
436
    	<?php } ?>
437
 
438
    </table>
439
 
7841 daniel 440
	<script>
5488 daniel 441
 
6438 daniel 442
	function wpsg_vp_vari_setPic(htmlElement, var_id, vari_id, attachment_id, product_id)
6094 hartmut 443
	{
444
 
445
		<?php if (!isset($_REQUEST['wpsg_lang'])) { ?>
446
 
447
		wpsg_vp_ajaxloading_show();
6438 daniel 448
 
6094 hartmut 449
		jQuery.ajax( {
450
			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']; ?>",
451
			async: false,
452
			data: {
453
				var_id: var_id,
454
				vari_id: vari_id,
6438 daniel 455
				product_id: product_id,
456
				attachment_id: attachment_id
6094 hartmut 457
			},
458
			success: function(data) {
6438 daniel 459
 
460
				jQuery(htmlElement).toggleClass('mark');
461
 
6094 hartmut 462
				wpsg_vp_ajaxloading_hide();
463
 
464
			}
465
		} );
466
 
467
		<?php } ?>
468
 
469
		return false;
470
 
471
	}
472
 
473
	function wpsg_vp_ajaxloading_show()
474
	{
475
 
6136 hartmut 476
		jQuery('.wpsg_mod_productvariants_ajaxloading').show();
6094 hartmut 477
 
478
	}
479
 
480
	function wpsg_vp_ajaxloading_hide()
481
	{
482
 
6136 hartmut 483
		jQuery('.wpsg_mod_productvariants_ajaxloading').hide();
6094 hartmut 484
 
485
	}
486
 
487
 
6149 hartmut 488
		<?php
489
			$b1 = wpsg_isSizedInt($this->view['product_id']);
490
			$b2 = wpsg_isSizedInt($this->view['variant']['product_id']);
491
			if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) {
6094 hartmut 492
		?>
6149 hartmut 493
			<?php
494
				$p1 = wpsg_getInt($this->view['product_id']);
495
				$p2 = ($this->view['variant']['product_id']);
496
			?>
5488 daniel 497
 
498
		jQuery('.wpsg_mod_productvariants_table_variation').sortable( {
499
			items: 'tbody',
500
			helper: wpsg_Tablefix,
501
			update: function(event, ui) {
502
 
503
				var wpsg_reorder = jQuery(this).sortable('toArray');
504
				var product_id = jQuery('#wpsg_mod_productvariants_product_id').val();
6149 hartmut 505
 
5488 daniel 506
				jQuery.ajax( {
507
					url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1',
508
					data: {
509
						'field': 'vari_pos',
510
						'value': jQuery(this).sortable('toArray'),
511
						'product_id': product_id
512
					},
513
					success: function(data) { }
514
				} );
515
 
516
			}
517
		} ).disableSelection();
518
 
519
		<?php } ?>
520
 
521
		<?php if (wpsg_isSizedInt($this->view['variant']['product_id']) || !wpsg_isSizedInt($this->view['product_id'])) { ?>
522
		jQuery('#wpsg_mod_productvariants_variation_add_button').show();
523
		<?php } else { ?>
524
		jQuery('#wpsg_mod_productvariants_variation_add_button').hide();
525
		<?php } ?>
7841 daniel 526
 
527
        jQuery('.wpsg_mod_productvariants_remove_global_vari_image').on('click', function() {
528
 
529
            let el = jQuery(this);
530
 
531
            event.preventDefault();
532
 
533
            if (!confirm('<?php echo __('Sind Sie sich sicher?', 'wpsg'); ?>')) return;
534
 
535
            el.remove();
536
 
537
            jQuery.ajax({
538
                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_removeImage&noheader=1',
539
                async: true,
540
                data: {
541
                    product_id: 0,
542
                    variant_id: el.data('variant_id'),
543
                    vari_id: el.data('variation_id'),
544
                    attachment_id: el.data('attachment_id')
545
                },
546
                success: function(data) { }
547
            });
548
 
549
        });
550
 
551
	</script>
7849 daniel 552
 
5488 daniel 553
    <?php if (!wpsg_isSizedInt($this->view['product_id'])) { ?>
554
    <p class="wpsg_hinweis"><?php echo __('Reihenfolge kann mittels Drag&Drop verändert werden.', 'wpsg'); ?></p>
555
    <?php } ?>
556
 
557
<?php } else { ?>
5583 daniel 558
 
559
	<?php echo __('Bisher keine Variationen der Variante angelegt.', 'wpsg'); ?>
560
 
7841 daniel 561
	<script>
5583 daniel 562
 
563
		<?php if (wpsg_isSizedInt($this->view['variant']['product_id']) || !wpsg_isSizedInt($this->view['product_id'])) { ?>
564
			jQuery('.wpsg_mod_productvariants_variation_add_button').show();
565
		<?php } else { ?>
566
			jQuery('.wpsg_mod_productvariants_variation_add_button').hide();
567
		<?php } ?>
568
 
7841 daniel 569
    </script>
5583 daniel 570
 
7841 daniel 571
<?php } ?>
572