Subversion Repositories wpShopGermany4

Rev

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