Subversion Repositories wpShopGermany4

Rev

Rev 7746 | Rev 7842 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7746 Rev 7841
Line 3... Line 3...
3
	/**
3
	/**
4
	 * Template um eine Variante zu bearbeiten
4
	 * Template um eine Variante zu bearbeiten
5
	 */
5
	 */
6
 
6
 
7
?>
7
?>
8
 
8
 
9
<input type="hidden" id="wpsg_mod_productvariants_product_id" value="<?php echo $this->view['product_id']; ?>" />
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']; ?>" />
10
<input type="hidden" id="wpsg_mod_productvariants_var_id" value="<?php echo $this->view['variant']['id']; ?>" />
11
 
11
 
-
 
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
 
12
<?php if (wpsg_isSizedArray($this->view['arVariation'])) { ?>
24
<?php if (wpsg_isSizedArray($this->view['arVariation'])) { ?>
13
 
25
 
14
	<table class="table wpsg_mod_productvariants_table_variation">
26
	<table class="table wpsg_mod_productvariants_table_variation">
15
    	<thead>
27
    	<thead>
16
      		<tr>
28
      		<tr>
Line 47... Line 59...
47
			    <th class="col_action"></th>
59
			    <th class="col_action"></th>
48
		        <?php } ?>
60
		        <?php } ?>
49
        		
61
        		
50
      		</tr>
62
      		</tr>
51
    	</thead>
63
    	</thead>
52
    	<?php $i = 0; foreach ($this->view['arVariation'] as $vari) { $i ++; ?>
64
    	<?php $i = 0; foreach ($this->view['arVariation'] as $vari) { $i ++;
-
 
65
 
-
 
66
		    $vari_id = intval($vari['id']);
-
 
67
 
-
 
68
	    ?>
53
    	<tbody id="vari_<?php echo $vari['id']; ?>">
69
    	<tbody id="vari_<?php echo $vari['id']; ?>">
54
    		<tr>    		
70
    		<tr>    		
55
    		
71
    		
56
    			<?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
72
    			<?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
57
    			<td class="col_active">
73
    			<td class="col_active">
Line 178... Line 194...
178
    				
194
    				
179
    			</td>    
195
    			</td>    
180
    			<?php } ?>
196
    			<?php } ?>
181
    			
197
    			
182
    		</tr>
198
    		</tr>
183
    		 
199
 
184
			<?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
-
 
185
    		<tr class="wpsg_mod_productvariants_productimage_row">
200
    		<tr class="wpsg_mod_productvariants_productimage_row">
186
    			<td class="col_active">&nbsp;</td>
201
    			<td class="col_active">&nbsp;</td>
187
   				<?php 
202
   				<?php 
188
				 
203
 
-
 
204
                    if (wpsg_isSizedInt($this->view['product_id'])) {
-
 
205
 
189
					$arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['product_id'], $vari['id'], true);
206
                        $arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['product_id'], $vari['id'], true);
-
 
207
 
-
 
208
                    } else {
-
 
209
 
-
 
210
                        $vari_images = $this->get_option('wpsg_mod_productvariants_global_images');
-
 
211
                        if (!is_array($vari_images)) $vari_images = [];
-
 
212
 
-
 
213
                        $arAttachmentIDs = ((isset($vari_images[$vari_id]))?$vari_images[$vari_id]:[]);
-
 
214
 
-
 
215
                    }
190
					
216
					
191
				?>
217
				?>
192
				<td class="ui-sortable" colspan="<?php echo $colspan; ?>"  id="wpsg_images_productimage_<?php echo $this->view['variant']['id']; ?>_<?php echo $vari['id']; ?>" >
218
				<td class="ui-sortable" colspan="<?php echo $colspan; ?>"  id="wpsg_images_productimage_<?php echo $this->view['variant']['id']; ?>_<?php echo $vari['id']; ?>" >
193
			 
219
 
-
 
220
                    <div class="d-flex justify-content-between w-100">
-
 
221
 
-
 
222
                        <div>
-
 
223
                            <?php foreach ($arAttachmentIDs as $attachment_id) { $attachment_id = intval($attachment_id); ?>
-
 
224
 
-
 
225
                                <?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
-
 
226
 
194
					<?php foreach ($arAttachmentIDs as $attachment_id) { ?>
227
                                    <a href="#" class="<?php echo ((in_array($attachment_id, explode(",", $vari['images_set'])))?'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']; ?>);">
-
 
228
                                        <?php echo wp_get_attachment_image($attachment_id, array(25, 25), true); ?>
-
 
229
                                    </a>
195
					
230
 
196
						<a href="#" class="<?php echo ((in_array($attachment_id, explode(",", $vari['images_set'])))?'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']; ?>);">
231
                                <?php } else { ?>
197
							
232
 
-
 
233
                                    <a href="#" class="pic wpsg_mod_productvariants_remove_global_vari_image"
-
 
234
                                        data-variant_id="<?php echo intval($_REQUEST['variant_id']); ?>"
-
 
235
                                        data-variation_id="<?php echo $vari['id']; ?>"
-
 
236
                                        data-attachment_id="<?php echo $attachment_id; ?>"
-
 
237
                                    >
198
							<?php echo wp_get_attachment_image($attachment_id, array(25, 25), true); ?>
238
                                        <?php echo wp_get_attachment_image($attachment_id, array(25, 25), true); ?>
-
 
239
                                        <span><span class="glyphicon glyphicon-trash"></span></span>
-
 
240
                                    </a>
-
 
241
 
-
 
242
                                <?php } ?>
199
							
243
 
-
 
244
                            <?php } ?>
200
						</a>
245
                        </div>
-
 
246
 
-
 
247
                        <?php if (!wpsg_isSizedInt($this->view['product_id'])) { ?>
-
 
248
                        <div>
-
 
249
 
-
 
250
                            <input id="media_upload_<?php echo $vari['id']; ?>" value="<?php echo __('Mediathek', 'wpsg'); ?>" class="button" type="button" />
201
						
251
 
-
 
252
                        </div>
202
					<?php } ?>
253
                        <?php } ?>
-
 
254
 
-
 
255
                    </div>
203
					
256
					
204
					<script type="text/javascript">
257
					<script>
205
 
258
 
206
						jQuery(document).ready(function() {   
259
						jQuery(document).ready(function() {   
-
 
260
 
-
 
261
							<?php if (intval($this->view['product_id']) <= 0) { ?>
-
 
262
							document.getElementById('media_upload_<?php echo $vari['id']; ?>').addEventListener('click', (event) => {
-
 
263
 
-
 
264
								event.preventDefault();
-
 
265
 
-
 
266
								wpsg_mod_productvariants_vari_id = <?php echo $vari['id']; ?>;
-
 
267
 
-
 
268
								if (wpframe !== undefined) { wpframe.open(); return; }
-
 
269
 
-
 
270
								wpframe = wp.media.frames.file_frame = wp.media({
-
 
271
                                    title: "<?php echo __('Auswählen oder Hochladen von Medien', 'wpsg'); ?>",
-
 
272
                                    button: { text: "<?php echo __('Medien benutzen', 'wpsg'); ?>" },
-
 
273
                                    multiple: true
-
 
274
					            });
-
 
275
 
-
 
276
								wpframe.on('select', () => {
-
 
277
 
-
 
278
									let arAtt = [];
-
 
279
				                    let attachments = wpframe.state().get('selection').map((attachment) => {
-
 
280
 
-
 
281
                                        attachment.toJSON();
-
 
282
 
-
 
283
                                        arAtt.push(attachment.id);
-
 
284
 
-
 
285
                                        return attachment;
-
 
286
 
-
 
287
				                    });
-
 
288
 
-
 
289
				                    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'); ?>" />');
-
 
290
 
-
 
291
				                    jQuery.ajax({
-
 
292
                                        url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_upload&noheader=1',
-
 
293
                                        async: true,
-
 
294
                                        data: {
-
 
295
                                            product_id: '<?php echo intval($_REQUEST['product_id']); ?>',
-
 
296
                                            variant_id: '<?php echo intval($_REQUEST['variant_id']); ?>',
-
 
297
                                            vari_id: wpsg_mod_productvariants_vari_id,
-
 
298
                                            arAtt: arAtt
-
 
299
                                        },
-
 
300
                                        success: function(data) {
-
 
301
 
-
 
302
                                            jQuery('#wpsg_mod_productvariants_dialog_modal .modal-body').html(data);
-
 
303
 
-
 
304
                                        }
-
 
305
                                    });
-
 
306
 
-
 
307
                                });
-
 
308
 
-
 
309
								wpframe.open();
-
 
310
 
-
 
311
                            });
-
 
312
							<?php } ?>
207
			   				 
313
 
-
 
314
							<?php if (intval($this->view['product_id']) > 0) { ?>
208
					   		jQuery('#wpsg_images_productimage_<?php echo $this->view['variant']['id']; ?>_<?php  echo $vari['id']; ?>').sortable( {
315
					   		jQuery('#wpsg_images_productimage_<?php echo $this->view['variant']['id']; ?>_<?php  echo $vari['id']; ?>').sortable( {
209
								items: 'a',
316
								items: 'a',
210
								helper : 'clone',  
317
								helper : 'clone',  
211
								update: function(event, ui) {
318
								update: function(event, ui) {
212
 
319
 
Line 230... Line 337...
230
 
337
 
231
										}
338
										}
232
									} );
339
									} );
233
																				 
340
																				 
234
								}			
341
								}			
235
							} ).disableSelection(); 
342
							} ).disableSelection();
-
 
343
					   		<?php } ?>
236
 
344
 
237
			   			} );
345
			   			} );
238
			   		
346
			   		
239
					</script>
347
					</script>
240
					
348
					
241
				</td>
349
				</td>
242
				 				
350
				 				
243
    		</tr>
351
    		</tr>
244
			<?php } ?>
-
 
245
 
352
 
246
    	</tbody>
353
    	</tbody>
247
    	<?php } ?>    	
354
    	<?php } ?>    	
248
    	    	
355
    	    	
249
    </table>
356
    </table>
250
 
357
 
251
	<script type="text/javascript">/* <![CDATA[ */
358
	<script>
252
 
359
 
253
	function wpsg_vp_vari_setPic(htmlElement, var_id, vari_id, attachment_id, product_id)
360
	function wpsg_vp_vari_setPic(htmlElement, var_id, vari_id, attachment_id, product_id)
254
	{
361
	{
255
 
362
 
256
		<?php if (!isset($_REQUEST['wpsg_lang'])) { ?>
363
		<?php if (!isset($_REQUEST['wpsg_lang'])) { ?>
Line 332... Line 439...
332
		<?php if (wpsg_isSizedInt($this->view['variant']['product_id']) || !wpsg_isSizedInt($this->view['product_id'])) { ?>
439
		<?php if (wpsg_isSizedInt($this->view['variant']['product_id']) || !wpsg_isSizedInt($this->view['product_id'])) { ?>
333
		jQuery('#wpsg_mod_productvariants_variation_add_button').show();
440
		jQuery('#wpsg_mod_productvariants_variation_add_button').show();
334
		<?php } else { ?>
441
		<?php } else { ?>
335
		jQuery('#wpsg_mod_productvariants_variation_add_button').hide();
442
		jQuery('#wpsg_mod_productvariants_variation_add_button').hide();
336
		<?php } ?>	
443
		<?php } ?>	
337
			
444
 
-
 
445
        jQuery('.wpsg_mod_productvariants_remove_global_vari_image').on('click', function() {
-
 
446
 
-
 
447
            let el = jQuery(this);
-
 
448
 
-
 
449
            event.preventDefault();
-
 
450
 
-
 
451
            if (!confirm('<?php echo __('Sind Sie sich sicher?', 'wpsg'); ?>')) return;
-
 
452
 
-
 
453
            el.remove();
-
 
454
 
-
 
455
            jQuery.ajax({
-
 
456
                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_removeImage&noheader=1',
-
 
457
                async: true,
-
 
458
                data: {
-
 
459
                    product_id: 0,
-
 
460
                    variant_id: el.data('variant_id'),
-
 
461
                    vari_id: el.data('variation_id'),
-
 
462
                    attachment_id: el.data('attachment_id')
-
 
463
                },
-
 
464
                success: function(data) { }
-
 
465
            });
-
 
466
 
-
 
467
        });
-
 
468
 
338
	/* ]]> */</script> 
469
	</script>
339
    
470
    
340
    <?php if (!wpsg_isSizedInt($this->view['product_id'])) { ?>
471
    <?php if (!wpsg_isSizedInt($this->view['product_id'])) { ?>
341
    <p class="wpsg_hinweis"><?php echo __('Reihenfolge kann mittels Drag&Drop verändert werden.', 'wpsg'); ?></p>
472
    <p class="wpsg_hinweis"><?php echo __('Reihenfolge kann mittels Drag&Drop verändert werden.', 'wpsg'); ?></p>
342
    <?php } ?>
473
    <?php } ?>
343
 
474
 
344
<?php } else { ?>
475
<?php } else { ?>
345
 
476
 
346
	<?php echo __('Bisher keine Variationen der Variante angelegt.', 'wpsg'); ?>
477
	<?php echo __('Bisher keine Variationen der Variante angelegt.', 'wpsg'); ?>
347
 
478
 
348
	<script type="text/javascript">/* <![CDATA[ */
479
	<script>
349
 
480
 
350
		<?php if (wpsg_isSizedInt($this->view['variant']['product_id']) || !wpsg_isSizedInt($this->view['product_id'])) { ?>
481
		<?php if (wpsg_isSizedInt($this->view['variant']['product_id']) || !wpsg_isSizedInt($this->view['product_id'])) { ?>
351
			jQuery('.wpsg_mod_productvariants_variation_add_button').show();
482
			jQuery('.wpsg_mod_productvariants_variation_add_button').show();
352
		<?php } else { ?>
483
		<?php } else { ?>
353
			jQuery('.wpsg_mod_productvariants_variation_add_button').hide();
484
			jQuery('.wpsg_mod_productvariants_variation_add_button').hide();
354
		<?php } ?>
485
		<?php } ?>
355
 
486
 
356
	/* ]]> */</script>
487
    </script>
-
 
488
 
-
 
489
<?php } ?>
357
 
490
 
358
<?php } ?>
-
 
359
491