Subversion Repositories wpShopGermany4

Rev

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