Subversion Repositories wpShopGermany4

Rev

Rev 7096 | Rev 7841 | 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
?>
6467 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
 
12
<?php if (wpsg_isSizedArray($this->view['arVariation'])) { ?>
13
 
14
	<table class="table wpsg_mod_productvariants_table_variation">
15
    	<thead>
16
      		<tr>
17
 
6891 hartmut 18
      			<?php $colspan = 0; if (wpsg_isSizedInt($this->view['product_id'])) { ?>
6357 thomas 19
      			<th class="col_active"><?php echo __('Aktiv', 'wpsg'); ?></th>
7746 daniel 20
      		    <?php } ?>
21
 
5488 daniel 22
      			<th class="col_id"><?php echo __('Id', 'wpsg'); ?></th>
23
        		<th class="col1"><?php echo __('Name', 'wpsg'); ?></th>
5521 daniel 24
        		<th class="col_shortname"><?php echo __('Kurzname'); ?></th>
7746 daniel 25
      			<?php $colspan += 3; ?>
5488 daniel 26
 
6891 hartmut 27
        		<?php if (wpsg_isSizedInt($this->view['product_id'])) { $colspan += 2; ?>
5488 daniel 28
        		<th class="col_artnr"><?php echo __('Artikelnummer', 'wpsg'); ?></th>
29
        		<th class="col_price"><?php echo __('Preis', 'wpsg'); ?></th>
6193 hartmut 30
 
31
				<?php if ($this->hasMod('wpsg_mod_stock')) { ?>
6891 hartmut 32
        		<th class="col_stock"><?php echo __('Lagerbestand', 'wpsg'); $colspan ++; ?></th>
7096 florian 33
		        <th class="col_stock col_min_stock"><?php echo __('Minimallagerbestand', 'wpsg'); $colspan ++; ?></th>
34
		        <?php } ?>
6165 hartmut 35
 
36
				<?php if ($this->hasMod('wpsg_mod_weight')) { ?>
6891 hartmut 37
        		<th class="col_stock"><?php echo __('Gewicht', 'wpsg'); $colspan ++; ?></th>
5488 daniel 38
        		<?php } ?>
6193 hartmut 39
 
6165 hartmut 40
				<?php if ($this->hasMod('wpsg_mod_fuellmenge')) { ?>
6891 hartmut 41
        		<th class="col_stock"><?php echo __('Füllmenge', 'wpsg'); $colspan ++; ?></th>
6165 hartmut 42
        		<?php } ?>
5583 daniel 43
 
6165 hartmut 44
        		<?php } ?>
45
 
5583 daniel 46
		        <?php if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) { $colspan ++; ?>
47
			    <th class="col_action"></th>
48
		        <?php } ?>
5488 daniel 49
 
50
      		</tr>
7096 florian 51
    	</thead>
5488 daniel 52
    	<?php $i = 0; foreach ($this->view['arVariation'] as $vari) { $i ++; ?>
53
    	<tbody id="vari_<?php echo $vari['id']; ?>">
54
    		<tr>
55
 
56
    			<?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
57
    			<td class="col_active">
58
    				<input type="checkbox" id="productvariation_active_<?php echo $vari['id']; ?>" name="active" value="1" <?php echo ((wpsg_isSizedString($vari['active'], '1'))?'checked="checked"':''); ?> />
59
    			</td>
60
    			<?php } ?>
61
 
62
    			<td class="col_id">
63
    				<?php echo $vari['id']; ?>
64
    				<script type="text/javascript">/* <![CDATA[ */
65
 
5583 daniel 66
    					<?php if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) { ?>
5934 hartmut 67
						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 68
							submitdata: {
69
					    		field: 'vari_name',
70
					    		field_id: '<?php echo $vari['id']; ?>'
71
							}
5521 daniel 72
						});
73
 
5934 hartmut 74
						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 75
							submitdata: {
76
					    		field: 'vari_shortname',
77
					    		field_id: '<?php echo $vari['id']; ?>'
78
							}
5583 daniel 79
						});
80
					    <?php } ?>
5488 daniel 81
 
82
						jQuery('#productvariation_active_<?php echo $vari['id']; ?>').bind('change', function() {
83
 
84
							var value = '0';
85
							if (jQuery(this).prop('checked') === true) value = '1';
86
 
87
							jQuery.ajax( {
88
								url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1',
89
								data: {
90
									field: 'vari_active',
91
									field_id: '<?php echo $vari['id']; ?>',
92
									product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
93
									value: value
94
								}
95
							} );
96
 
97
						} );
98
 
5934 hartmut 99
						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 100
							submitdata: {
101
					    		field: 'vari_anr',
102
					    		product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
103
					    		field_id: '<?php echo $vari['id']; ?>'
104
							}
105
						});
106
 
5934 hartmut 107
						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 108
							submitdata: {
109
					    		field: 'vari_price',
110
					    		product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
111
					    		field_id: '<?php echo $vari['id']; ?>'
112
							}
113
						});
114
 
5934 hartmut 115
						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 116
							submitdata: {
117
					    		field: 'vari_stock',
118
					    		product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
119
					    		field_id: '<?php echo $vari['id']; ?>'
120
							}
121
						});
5583 daniel 122
 
7096 florian 123
					    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', {
124
						    submitdata: {
125
							    field: 'vari_min_stock',
126
							    product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
127
							    field_id: '<?php echo $vari['id']; ?>'
128
						    }
129
					    });
130
 
131
					    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 132
							submitdata: {
133
					    		field: 'vari_weight',
134
					    		product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
135
					    		field_id: '<?php echo $vari['id']; ?>'
136
							}
137
						});
138
 
139
						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', {
140
							submitdata: {
141
					    		field: 'vari_fmenge',
142
					    		product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
143
					    		field_id: '<?php echo $vari['id']; ?>'
144
							}
145
						});
146
 
5488 daniel 147
 
148
					/* ]]> */</script>
149
    			</td>
6149 hartmut 150
    			<td class="col1"><span class="wpsg_editable" id="productvariation_name_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['name']); ?></span>
151
    			<?php if (!isset($vari['iid'])) $vari['iid'] = $vari['id'];  ?>
152
    			<input type="hidden" id="productvariation_iid_<?php echo $vari['id']; ?>" value="<?php echo wpsg_getStr($vari['iid']); ?>" />
153
    			</td>
5521 daniel 154
    			<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 155
 
156
    			<?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
157
    			<td class="col_artnr"><span class="wpsg_editable" id="productvariation_anr_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['anr']); ?></span></td>
158
    			<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 159
 
6193 hartmut 160
				<?php if ($this->hasMod('wpsg_mod_stock')) { ?>
5488 daniel 161
    			<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 162
    			<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 163
        		<?php } ?>
6165 hartmut 164
 
165
				<?php if ($this->hasMod('wpsg_mod_weight')) { ?>
166
    			<td class="col_stock"><span class="wpsg_editable" id="productvariation_weight_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['weight']); ?></span></td>
167
        		<?php } ?>
168
				<?php if ($this->hasMod('wpsg_mod_fuellmenge')) { ?>
169
    			<td class="col_stock"><span class="wpsg_editable" id="productvariation_fmenge_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['fmenge']); ?></span></td>
170
        		<?php } ?>
171
 
5583 daniel 172
    			<?php } ?>
173
 
174
			    <?php if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) { ?>
175
				<td class="col_action">
5488 daniel 176
 
6454 hartmut 177
    				<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 178
 
179
    			</td>
5583 daniel 180
    			<?php } ?>
5488 daniel 181
 
182
    		</tr>
5490 daniel 183
 
6467 daniel 184
			<?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
6136 hartmut 185
    		<tr class="wpsg_mod_productvariants_productimage_row">
6891 hartmut 186
    			<td class="col_active">&nbsp;</td>
6136 hartmut 187
   				<?php
6438 daniel 188
 
6458 daniel 189
					$arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['product_id'], $vari['id'], true);
6438 daniel 190
 
6136 hartmut 191
				?>
6438 daniel 192
				<td class="ui-sortable" colspan="<?php echo $colspan; ?>"  id="wpsg_images_productimage_<?php echo $this->view['variant']['id']; ?>_<?php echo $vari['id']; ?>" >
193
 
194
					<?php foreach ($arAttachmentIDs as $attachment_id) { ?>
6094 hartmut 195
 
6438 daniel 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']; ?>);">
197
 
198
							<?php echo wp_get_attachment_image($attachment_id, array(25, 25), true); ?>
199
 
200
						</a>
201
 
202
					<?php } ?>
203
 
204
					<script type="text/javascript">
6136 hartmut 205
 
6438 daniel 206
						jQuery(document).ready(function() {
207
 
208
					   		jQuery('#wpsg_images_productimage_<?php echo $this->view['variant']['id']; ?>_<?php  echo $vari['id']; ?>').sortable( {
6136 hartmut 209
								items: 'a',
210
								helper : 'clone',
211
								update: function(event, ui) {
212
 
213
									wpsg_vp_ajaxloading_show();
214
 
215
									var wpsg_reorder = jQuery(this).sortable('toArray');
6438 daniel 216
 
6136 hartmut 217
									jQuery.ajax( {
218
										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']; ?>',
219
										async: false,
220
										data: {
6438 daniel 221
											'var_id': <?php echo $this->view['variant']['id']; ?>,
222
											'vari_id': <?php echo $vari['id']; ?>,
6136 hartmut 223
											'wpsg_reorder': wpsg_reorder
224
										},
225
										success: function(data) {
226
 
227
											if (data != '1') alert(data);
6438 daniel 228
 
6136 hartmut 229
											wpsg_vp_ajaxloading_hide();
230
 
231
										}
232
									} );
233
 
234
								}
6438 daniel 235
							} ).disableSelection();
6136 hartmut 236
 
237
			   			} );
238
 
6438 daniel 239
					</script>
240
 
241
				</td>
242
 
5488 daniel 243
    		</tr>
6467 daniel 244
			<?php } ?>
5490 daniel 245
 
5488 daniel 246
    	</tbody>
247
    	<?php } ?>
248
 
249
    </table>
250
 
251
	<script type="text/javascript">/* <![CDATA[ */
252
 
6438 daniel 253
	function wpsg_vp_vari_setPic(htmlElement, var_id, vari_id, attachment_id, product_id)
6094 hartmut 254
	{
255
 
256
		<?php if (!isset($_REQUEST['wpsg_lang'])) { ?>
257
 
258
		wpsg_vp_ajaxloading_show();
6438 daniel 259
 
6094 hartmut 260
		jQuery.ajax( {
261
			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']; ?>",
262
			async: false,
263
			data: {
264
				var_id: var_id,
265
				vari_id: vari_id,
6438 daniel 266
				product_id: product_id,
267
				attachment_id: attachment_id
6094 hartmut 268
			},
269
			success: function(data) {
6438 daniel 270
 
271
				jQuery(htmlElement).toggleClass('mark');
272
 
6094 hartmut 273
				wpsg_vp_ajaxloading_hide();
274
 
275
			}
276
		} );
277
 
278
		<?php } ?>
279
 
280
		return false;
281
 
282
	}
283
 
284
	function wpsg_vp_ajaxloading_show()
285
	{
286
 
6136 hartmut 287
		jQuery('.wpsg_mod_productvariants_ajaxloading').show();
6094 hartmut 288
 
289
	}
290
 
291
	function wpsg_vp_ajaxloading_hide()
292
	{
293
 
6136 hartmut 294
		jQuery('.wpsg_mod_productvariants_ajaxloading').hide();
6094 hartmut 295
 
296
	}
297
 
298
 
6149 hartmut 299
		<?php
300
			$b1 = wpsg_isSizedInt($this->view['product_id']);
301
			$b2 = wpsg_isSizedInt($this->view['variant']['product_id']);
302
			if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) {
6094 hartmut 303
		?>
6149 hartmut 304
			<?php
305
				$p1 = wpsg_getInt($this->view['product_id']);
306
				$p2 = ($this->view['variant']['product_id']);
307
			?>
5488 daniel 308
 
309
		jQuery('.wpsg_mod_productvariants_table_variation').sortable( {
310
			items: 'tbody',
311
			helper: wpsg_Tablefix,
312
			update: function(event, ui) {
313
 
314
				var wpsg_reorder = jQuery(this).sortable('toArray');
315
				var product_id = jQuery('#wpsg_mod_productvariants_product_id').val();
6149 hartmut 316
 
5488 daniel 317
				jQuery.ajax( {
318
					url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1',
319
					data: {
320
						'field': 'vari_pos',
321
						'value': jQuery(this).sortable('toArray'),
322
						'product_id': product_id
323
					},
324
					success: function(data) { }
325
				} );
326
 
327
			}
328
		} ).disableSelection();
329
 
330
		<?php } ?>
331
 
332
		<?php if (wpsg_isSizedInt($this->view['variant']['product_id']) || !wpsg_isSizedInt($this->view['product_id'])) { ?>
333
		jQuery('#wpsg_mod_productvariants_variation_add_button').show();
334
		<?php } else { ?>
335
		jQuery('#wpsg_mod_productvariants_variation_add_button').hide();
336
		<?php } ?>
337
 
338
	/* ]]> */</script>
339
 
340
    <?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>
342
    <?php } ?>
343
 
344
<?php } else { ?>
5583 daniel 345
 
346
	<?php echo __('Bisher keine Variationen der Variante angelegt.', 'wpsg'); ?>
347
 
348
	<script type="text/javascript">/* <![CDATA[ */
349
 
350
		<?php if (wpsg_isSizedInt($this->view['variant']['product_id']) || !wpsg_isSizedInt($this->view['product_id'])) { ?>
351
			jQuery('.wpsg_mod_productvariants_variation_add_button').show();
352
		<?php } else { ?>
353
			jQuery('.wpsg_mod_productvariants_variation_add_button').hide();
354
		<?php } ?>
355
 
356
	/* ]]> */</script>
357
 
5488 daniel 358
<?php } ?>