5488 |
daniel |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* Verwaltung der Produktvarianten im Backend
|
|
|
5 |
*/
|
|
|
6 |
|
|
|
7 |
?>
|
|
|
8 |
|
|
|
9 |
<input type="hidden" id="wpsg_mod_productvariants_product_id" value="<?php echo $this->view['product_id']; ?>" />
|
|
|
10 |
|
|
|
11 |
<?php if (wpsg_isSizedArray($this->view['arVariants'])) { ?>
|
|
|
12 |
|
|
|
13 |
<table class="table table-striped wpsg_mod_productvariants_table_variants">
|
|
|
14 |
<thead>
|
|
|
15 |
<tr>
|
|
|
16 |
<th class="col_id"><?php echo __('Id', 'wpsg'); ?></th>
|
|
|
17 |
<th class="col1"><?php echo __('Name', 'wpsg'); ?></th>
|
5489 |
daniel |
18 |
<th class="col_type"><?php echo __('Typ', 'wpsg'); ?></th>
|
5488 |
daniel |
19 |
<th class="col_vari"><?php echo __('Variationen', 'wpsg'); ?></th>
|
|
|
20 |
|
|
|
21 |
<?php if (!wpsg_isSizedInt($this->view['product_id'])) { ?>
|
|
|
22 |
<th class="col_products"><?php echo __('Produkte', 'wpsg'); ?></th>
|
|
|
23 |
<?php } ?>
|
|
|
24 |
|
|
|
25 |
<th class="col_action"></th>
|
|
|
26 |
</tr>
|
|
|
27 |
</thead>
|
|
|
28 |
<tbody>
|
|
|
29 |
<?php foreach ($this->view['arVariants'] as $var) { ?>
|
|
|
30 |
<tr id="var_<?php echo $var['id']; ?>">
|
|
|
31 |
<td class="col_id"><?php echo $var['id']; ?></td>
|
|
|
32 |
<td class="col1">
|
|
|
33 |
<span class="wpsg_editable" id="productvariants_name_<?php echo $var['id']; ?>"><?php echo wpsg_hspc($var['name']); ?></span>
|
|
|
34 |
<?php if (wpsg_isSizedInt($var['product_id'])) { ?>
|
|
|
35 |
<span class="wpsg_mod_productvariants_info"><?php echo __('(Produktbezogen)', 'wpsg'); ?></span>
|
|
|
36 |
<?php } ?>
|
|
|
37 |
</td>
|
5489 |
daniel |
38 |
<td class="col_type"><span class="wpsg_editable" id="productvariants_type_<?php echo $var['id']; ?>"><?php echo $var['type_label']; ?></span></td>
|
5488 |
daniel |
39 |
<td class="col_vari"><?php
|
|
|
40 |
|
|
|
41 |
if (wpsg_isSizedInt($this->view['product_id'])) echo $var['count_active'].'/'.$var['count_variation'];
|
|
|
42 |
else echo $var['count_variation'];
|
|
|
43 |
|
|
|
44 |
?></td>
|
|
|
45 |
<?php if (!wpsg_isSizedInt($this->view['product_id'])) { ?>
|
|
|
46 |
<td class="col_products"><?php echo wpsg_hspc($var['count_produkte']); ?></td>
|
|
|
47 |
<?php } ?>
|
|
|
48 |
<td class="col_action">
|
|
|
49 |
|
7841 |
daniel |
50 |
<script>
|
5488 |
daniel |
51 |
|
|
|
52 |
<?php if ((wpsg_isSizedInt($this->view['product_id']) && $this->view['product_id'] == $var['product_id']) || (!wpsg_isSizedInt($var['product_id']) && !wpsg_isSizedInt($this->view['product_id']))) { ?>
|
5489 |
daniel |
53 |
|
5934 |
hartmut |
54 |
jQuery('#productvariants_name_<?php echo $var['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 |
55 |
submitdata: {
|
|
|
56 |
field: 'name',
|
|
|
57 |
field_id: '<?php echo $var['id']; ?>'
|
|
|
58 |
}
|
|
|
59 |
});
|
5489 |
daniel |
60 |
|
5934 |
hartmut |
61 |
jQuery('#productvariants_type_<?php echo $var['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', {
|
5489 |
daniel |
62 |
submitdata: {
|
|
|
63 |
field: 'type',
|
|
|
64 |
field_id: '<?php echo $var['id']; ?>'
|
|
|
65 |
},
|
5945 |
hartmut |
66 |
data: <?php echo wpsg_prepare_for_inlineEdit(wpsg_mod_productvariants::$arTypeLabel); ?>,
|
5489 |
daniel |
67 |
type: 'select'
|
|
|
68 |
});
|
|
|
69 |
|
5488 |
daniel |
70 |
<?php } ?>
|
|
|
71 |
|
7841 |
daniel |
72 |
</script>
|
5488 |
daniel |
73 |
|
|
|
74 |
<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Variante bearbeiten', 'wpsg'); ?>" onclick="return wpsg_mod_productvariants_edit(<?php echo $var['id']; ?>);"><span class="glyphicon glyphicon-pencil"></span></a>
|
|
|
75 |
|
|
|
76 |
<?php if ((wpsg_isSizedInt($this->view['product_id']) && $this->view['product_id'] == $var['product_id']) || (!wpsg_isSizedInt($var['product_id']) && !wpsg_isSizedInt($this->view['product_id']))) { ?>
|
|
|
77 |
<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Variante löschen', 'wpsg'); ?>" onclick="return wpsg_mod_productvariants_del(<?php echo $var['id']; ?>);"><span class="glyphicon glyphicon-trash"></span></a>
|
|
|
78 |
<?php } ?>
|
|
|
79 |
|
|
|
80 |
</td>
|
|
|
81 |
</tr>
|
|
|
82 |
<?php } ?>
|
|
|
83 |
</tbody>
|
|
|
84 |
</table>
|
|
|
85 |
|
|
|
86 |
<p class="wpsg_hinweis"><?php echo __('Reihenfolge kann mittels Drag&Drop verändert werden.', 'wpsg'); ?></p>
|
|
|
87 |
|
7841 |
daniel |
88 |
<script>
|
5488 |
daniel |
89 |
|
|
|
90 |
jQuery('.wpsg_mod_productvariants_table_variants tbody').sortable( {
|
|
|
91 |
items: 'tr',
|
|
|
92 |
helper: wpsg_Tablefix,
|
|
|
93 |
update: function(event, ui) {
|
|
|
94 |
|
|
|
95 |
var wpsg_reorder = jQuery(this).sortable('toArray');
|
|
|
96 |
var product_id = jQuery('#wpsg_mod_productvariants_product_id').val();
|
|
|
97 |
|
|
|
98 |
jQuery.ajax( {
|
|
|
99 |
url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1',
|
|
|
100 |
data: {
|
|
|
101 |
'field': 'pos',
|
|
|
102 |
'product_id': product_id,
|
|
|
103 |
'value': jQuery(this).sortable('toArray')
|
|
|
104 |
},
|
|
|
105 |
success: function(data) { }
|
|
|
106 |
} );
|
|
|
107 |
|
|
|
108 |
}
|
6005 |
hartmut |
109 |
} );
|
5488 |
daniel |
110 |
|
7841 |
daniel |
111 |
</script>
|
5488 |
daniel |
112 |
|
|
|
113 |
<?php } else { ?>
|
|
|
114 |
<?php echo __('Bisher keine Produktvarianten angelegt.', 'wpsg'); ?>
|
|
|
115 |
<?php } ?>
|