Subversion Repositories wpShopGermany4

Rev

Rev 6467 | Rev 7096 | 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>
6193 hartmut 32
        		<?php } ?>
6165 hartmut 33
 
34
				<?php if ($this->hasMod('wpsg_mod_weight')) { ?>
6891 hartmut 35
        		<th class="col_stock"><?php echo __('Gewicht', 'wpsg'); $colspan ++; ?></th>
5488 daniel 36
        		<?php } ?>
6193 hartmut 37
 
6165 hartmut 38
				<?php if ($this->hasMod('wpsg_mod_fuellmenge')) { ?>
6891 hartmut 39
        		<th class="col_stock"><?php echo __('Füllmenge', 'wpsg'); $colspan ++; ?></th>
6165 hartmut 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
 
6467 daniel 173
			<?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
6136 hartmut 174
    		<tr class="wpsg_mod_productvariants_productimage_row">
6891 hartmut 175
    			<td class="col_active">&nbsp;</td>
6136 hartmut 176
   				<?php
6438 daniel 177
 
6458 daniel 178
					$arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['product_id'], $vari['id'], true);
6438 daniel 179
 
6136 hartmut 180
				?>
6438 daniel 181
				<td class="ui-sortable" colspan="<?php echo $colspan; ?>"  id="wpsg_images_productimage_<?php echo $this->view['variant']['id']; ?>_<?php echo $vari['id']; ?>" >
182
 
183
					<?php foreach ($arAttachmentIDs as $attachment_id) { ?>
6094 hartmut 184
 
6438 daniel 185
						<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']; ?>);">
186
 
187
							<?php echo wp_get_attachment_image($attachment_id, array(25, 25), true); ?>
188
 
189
						</a>
190
 
191
					<?php } ?>
192
 
193
					<script type="text/javascript">
6136 hartmut 194
 
6438 daniel 195
						jQuery(document).ready(function() {
196
 
197
					   		jQuery('#wpsg_images_productimage_<?php echo $this->view['variant']['id']; ?>_<?php  echo $vari['id']; ?>').sortable( {
6136 hartmut 198
								items: 'a',
199
								helper : 'clone',
200
								update: function(event, ui) {
201
 
202
									wpsg_vp_ajaxloading_show();
203
 
204
									var wpsg_reorder = jQuery(this).sortable('toArray');
6438 daniel 205
 
6136 hartmut 206
									jQuery.ajax( {
207
										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']; ?>',
208
										async: false,
209
										data: {
6438 daniel 210
											'var_id': <?php echo $this->view['variant']['id']; ?>,
211
											'vari_id': <?php echo $vari['id']; ?>,
6136 hartmut 212
											'wpsg_reorder': wpsg_reorder
213
										},
214
										success: function(data) {
215
 
216
											if (data != '1') alert(data);
6438 daniel 217
 
6136 hartmut 218
											wpsg_vp_ajaxloading_hide();
219
 
220
										}
221
									} );
222
 
223
								}
6438 daniel 224
							} ).disableSelection();
6136 hartmut 225
 
226
			   			} );
227
 
6438 daniel 228
					</script>
229
 
230
				</td>
231
 
5488 daniel 232
    		</tr>
6467 daniel 233
			<?php } ?>
5490 daniel 234
 
5488 daniel 235
    	</tbody>
236
    	<?php } ?>
237
 
238
    </table>
239
 
240
	<script type="text/javascript">/* <![CDATA[ */
241
 
6438 daniel 242
	function wpsg_vp_vari_setPic(htmlElement, var_id, vari_id, attachment_id, product_id)
6094 hartmut 243
	{
244
 
245
		<?php if (!isset($_REQUEST['wpsg_lang'])) { ?>
246
 
247
		wpsg_vp_ajaxloading_show();
6438 daniel 248
 
6094 hartmut 249
		jQuery.ajax( {
250
			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']; ?>",
251
			async: false,
252
			data: {
253
				var_id: var_id,
254
				vari_id: vari_id,
6438 daniel 255
				product_id: product_id,
256
				attachment_id: attachment_id
6094 hartmut 257
			},
258
			success: function(data) {
6438 daniel 259
 
260
				jQuery(htmlElement).toggleClass('mark');
261
 
6094 hartmut 262
				wpsg_vp_ajaxloading_hide();
263
 
264
			}
265
		} );
266
 
267
		<?php } ?>
268
 
269
		return false;
270
 
271
	}
272
 
273
	function wpsg_vp_ajaxloading_show()
274
	{
275
 
6136 hartmut 276
		jQuery('.wpsg_mod_productvariants_ajaxloading').show();
6094 hartmut 277
 
278
	}
279
 
280
	function wpsg_vp_ajaxloading_hide()
281
	{
282
 
6136 hartmut 283
		jQuery('.wpsg_mod_productvariants_ajaxloading').hide();
6094 hartmut 284
 
285
	}
286
 
287
 
6149 hartmut 288
		<?php
289
			$b1 = wpsg_isSizedInt($this->view['product_id']);
290
			$b2 = wpsg_isSizedInt($this->view['variant']['product_id']);
291
			if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) {
6094 hartmut 292
		?>
6149 hartmut 293
			<?php
294
				$p1 = wpsg_getInt($this->view['product_id']);
295
				$p2 = ($this->view['variant']['product_id']);
296
			?>
5488 daniel 297
 
298
		jQuery('.wpsg_mod_productvariants_table_variation').sortable( {
299
			items: 'tbody',
300
			helper: wpsg_Tablefix,
301
			update: function(event, ui) {
302
 
303
				var wpsg_reorder = jQuery(this).sortable('toArray');
304
				var product_id = jQuery('#wpsg_mod_productvariants_product_id').val();
6149 hartmut 305
 
5488 daniel 306
				jQuery.ajax( {
307
					url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1',
308
					data: {
309
						'field': 'vari_pos',
310
						'value': jQuery(this).sortable('toArray'),
311
						'product_id': product_id
312
					},
313
					success: function(data) { }
314
				} );
315
 
316
			}
317
		} ).disableSelection();
318
 
319
		<?php } ?>
320
 
321
		<?php if (wpsg_isSizedInt($this->view['variant']['product_id']) || !wpsg_isSizedInt($this->view['product_id'])) { ?>
322
		jQuery('#wpsg_mod_productvariants_variation_add_button').show();
323
		<?php } else { ?>
324
		jQuery('#wpsg_mod_productvariants_variation_add_button').hide();
325
		<?php } ?>
326
 
327
	/* ]]> */</script>
328
 
329
    <?php if (!wpsg_isSizedInt($this->view['product_id'])) { ?>
330
    <p class="wpsg_hinweis"><?php echo __('Reihenfolge kann mittels Drag&Drop verändert werden.', 'wpsg'); ?></p>
331
    <?php } ?>
332
 
333
<?php } else { ?>
5583 daniel 334
 
335
	<?php echo __('Bisher keine Variationen der Variante angelegt.', 'wpsg'); ?>
336
 
337
	<script type="text/javascript">/* <![CDATA[ */
338
 
339
		<?php if (wpsg_isSizedInt($this->view['variant']['product_id']) || !wpsg_isSizedInt($this->view['product_id'])) { ?>
340
			jQuery('.wpsg_mod_productvariants_variation_add_button').show();
341
		<?php } else { ?>
342
			jQuery('.wpsg_mod_productvariants_variation_add_button').hide();
343
		<?php } ?>
344
 
345
	/* ]]> */</script>
346
 
5488 daniel 347
<?php } ?>