Subversion Repositories wpShopGermany4

Rev

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