5488 |
daniel |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* Template um eine Variante zu bearbeiten
|
|
|
5 |
*/
|
|
|
6 |
|
|
|
7 |
?>
|
7841 |
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 |
|
7841 |
daniel |
12 |
<script>
|
|
|
13 |
|
|
|
14 |
var wpframe; var wpsg_mod_productvariants_vari_id = 0;
|
|
|
15 |
var metaBox = jQuery('#meta-box-id.postbox');
|
|
|
16 |
|
|
|
17 |
var addImgLink = metaBox.find('.upload-custom-img');
|
|
|
18 |
var delImgLink = metaBox.find('.delete-custom-img');
|
|
|
19 |
var imgContainer = metaBox.find('.custom-img-container');
|
|
|
20 |
var imgIdInput = metaBox.find('.custom-img-id');
|
|
|
21 |
|
|
|
22 |
</script>
|
|
|
23 |
|
5488 |
daniel |
24 |
<?php if (wpsg_isSizedArray($this->view['arVariation'])) { ?>
|
|
|
25 |
|
|
|
26 |
<table class="table wpsg_mod_productvariants_table_variation">
|
|
|
27 |
<thead>
|
|
|
28 |
<tr>
|
|
|
29 |
|
6891 |
hartmut |
30 |
<?php $colspan = 0; if (wpsg_isSizedInt($this->view['product_id'])) { ?>
|
6357 |
thomas |
31 |
<th class="col_active"><?php echo __('Aktiv', 'wpsg'); ?></th>
|
7746 |
daniel |
32 |
<?php } ?>
|
|
|
33 |
|
5488 |
daniel |
34 |
<th class="col_id"><?php echo __('Id', 'wpsg'); ?></th>
|
|
|
35 |
<th class="col1"><?php echo __('Name', 'wpsg'); ?></th>
|
5521 |
daniel |
36 |
<th class="col_shortname"><?php echo __('Kurzname'); ?></th>
|
7746 |
daniel |
37 |
<?php $colspan += 3; ?>
|
5488 |
daniel |
38 |
|
6891 |
hartmut |
39 |
<?php if (wpsg_isSizedInt($this->view['product_id'])) { $colspan += 2; ?>
|
5488 |
daniel |
40 |
<th class="col_artnr"><?php echo __('Artikelnummer', 'wpsg'); ?></th>
|
|
|
41 |
<th class="col_price"><?php echo __('Preis', 'wpsg'); ?></th>
|
6193 |
hartmut |
42 |
|
|
|
43 |
<?php if ($this->hasMod('wpsg_mod_stock')) { ?>
|
6891 |
hartmut |
44 |
<th class="col_stock"><?php echo __('Lagerbestand', 'wpsg'); $colspan ++; ?></th>
|
7096 |
florian |
45 |
<th class="col_stock col_min_stock"><?php echo __('Minimallagerbestand', 'wpsg'); $colspan ++; ?></th>
|
|
|
46 |
<?php } ?>
|
6165 |
hartmut |
47 |
|
|
|
48 |
<?php if ($this->hasMod('wpsg_mod_weight')) { ?>
|
6891 |
hartmut |
49 |
<th class="col_stock"><?php echo __('Gewicht', 'wpsg'); $colspan ++; ?></th>
|
5488 |
daniel |
50 |
<?php } ?>
|
6193 |
hartmut |
51 |
|
6165 |
hartmut |
52 |
<?php if ($this->hasMod('wpsg_mod_fuellmenge')) { ?>
|
6891 |
hartmut |
53 |
<th class="col_stock"><?php echo __('Füllmenge', 'wpsg'); $colspan ++; ?></th>
|
6165 |
hartmut |
54 |
<?php } ?>
|
5583 |
daniel |
55 |
|
6165 |
hartmut |
56 |
<?php } ?>
|
|
|
57 |
|
5583 |
daniel |
58 |
<?php if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) { $colspan ++; ?>
|
|
|
59 |
<th class="col_action"></th>
|
|
|
60 |
<?php } ?>
|
5488 |
daniel |
61 |
|
|
|
62 |
</tr>
|
7096 |
florian |
63 |
</thead>
|
7841 |
daniel |
64 |
<?php $i = 0; foreach ($this->view['arVariation'] as $vari) { $i ++;
|
|
|
65 |
|
|
|
66 |
$vari_id = intval($vari['id']);
|
|
|
67 |
|
|
|
68 |
?>
|
5488 |
daniel |
69 |
<tbody id="vari_<?php echo $vari['id']; ?>">
|
|
|
70 |
<tr>
|
|
|
71 |
|
|
|
72 |
<?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
|
|
|
73 |
<td class="col_active">
|
|
|
74 |
<input type="checkbox" id="productvariation_active_<?php echo $vari['id']; ?>" name="active" value="1" <?php echo ((wpsg_isSizedString($vari['active'], '1'))?'checked="checked"':''); ?> />
|
|
|
75 |
</td>
|
|
|
76 |
<?php } ?>
|
|
|
77 |
|
|
|
78 |
<td class="col_id">
|
|
|
79 |
<?php echo $vari['id']; ?>
|
|
|
80 |
<script type="text/javascript">/* <![CDATA[ */
|
|
|
81 |
|
5583 |
daniel |
82 |
<?php if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) { ?>
|
5934 |
hartmut |
83 |
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 |
84 |
submitdata: {
|
|
|
85 |
field: 'vari_name',
|
|
|
86 |
field_id: '<?php echo $vari['id']; ?>'
|
|
|
87 |
}
|
5521 |
daniel |
88 |
});
|
|
|
89 |
|
5934 |
hartmut |
90 |
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 |
91 |
submitdata: {
|
|
|
92 |
field: 'vari_shortname',
|
|
|
93 |
field_id: '<?php echo $vari['id']; ?>'
|
|
|
94 |
}
|
5583 |
daniel |
95 |
});
|
|
|
96 |
<?php } ?>
|
5488 |
daniel |
97 |
|
|
|
98 |
jQuery('#productvariation_active_<?php echo $vari['id']; ?>').bind('change', function() {
|
|
|
99 |
|
|
|
100 |
var value = '0';
|
|
|
101 |
if (jQuery(this).prop('checked') === true) value = '1';
|
|
|
102 |
|
|
|
103 |
jQuery.ajax( {
|
|
|
104 |
url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1',
|
|
|
105 |
data: {
|
|
|
106 |
field: 'vari_active',
|
|
|
107 |
field_id: '<?php echo $vari['id']; ?>',
|
|
|
108 |
product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
|
|
|
109 |
value: value
|
|
|
110 |
}
|
|
|
111 |
} );
|
|
|
112 |
|
|
|
113 |
} );
|
|
|
114 |
|
5934 |
hartmut |
115 |
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 |
116 |
submitdata: {
|
|
|
117 |
field: 'vari_anr',
|
|
|
118 |
product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
|
|
|
119 |
field_id: '<?php echo $vari['id']; ?>'
|
|
|
120 |
}
|
|
|
121 |
});
|
|
|
122 |
|
5934 |
hartmut |
123 |
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 |
124 |
submitdata: {
|
|
|
125 |
field: 'vari_price',
|
|
|
126 |
product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
|
|
|
127 |
field_id: '<?php echo $vari['id']; ?>'
|
|
|
128 |
}
|
|
|
129 |
});
|
|
|
130 |
|
5934 |
hartmut |
131 |
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 |
132 |
submitdata: {
|
|
|
133 |
field: 'vari_stock',
|
|
|
134 |
product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
|
|
|
135 |
field_id: '<?php echo $vari['id']; ?>'
|
|
|
136 |
}
|
|
|
137 |
});
|
5583 |
daniel |
138 |
|
7096 |
florian |
139 |
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', {
|
|
|
140 |
submitdata: {
|
|
|
141 |
field: 'vari_min_stock',
|
|
|
142 |
product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
|
|
|
143 |
field_id: '<?php echo $vari['id']; ?>'
|
|
|
144 |
}
|
|
|
145 |
});
|
|
|
146 |
|
|
|
147 |
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 |
148 |
submitdata: {
|
|
|
149 |
field: 'vari_weight',
|
|
|
150 |
product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
|
|
|
151 |
field_id: '<?php echo $vari['id']; ?>'
|
|
|
152 |
}
|
|
|
153 |
});
|
|
|
154 |
|
|
|
155 |
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', {
|
|
|
156 |
submitdata: {
|
|
|
157 |
field: 'vari_fmenge',
|
|
|
158 |
product_id: jQuery('#wpsg_mod_productvariants_product_id').val(),
|
|
|
159 |
field_id: '<?php echo $vari['id']; ?>'
|
|
|
160 |
}
|
|
|
161 |
});
|
|
|
162 |
|
5488 |
daniel |
163 |
|
|
|
164 |
/* ]]> */</script>
|
|
|
165 |
</td>
|
6149 |
hartmut |
166 |
<td class="col1"><span class="wpsg_editable" id="productvariation_name_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['name']); ?></span>
|
|
|
167 |
<?php if (!isset($vari['iid'])) $vari['iid'] = $vari['id']; ?>
|
|
|
168 |
<input type="hidden" id="productvariation_iid_<?php echo $vari['id']; ?>" value="<?php echo wpsg_getStr($vari['iid']); ?>" />
|
|
|
169 |
</td>
|
5521 |
daniel |
170 |
<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 |
171 |
|
|
|
172 |
<?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
|
|
|
173 |
<td class="col_artnr"><span class="wpsg_editable" id="productvariation_anr_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['anr']); ?></span></td>
|
|
|
174 |
<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 |
175 |
|
6193 |
hartmut |
176 |
<?php if ($this->hasMod('wpsg_mod_stock')) { ?>
|
5488 |
daniel |
177 |
<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 |
178 |
<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 |
179 |
<?php } ?>
|
6165 |
hartmut |
180 |
|
|
|
181 |
<?php if ($this->hasMod('wpsg_mod_weight')) { ?>
|
|
|
182 |
<td class="col_stock"><span class="wpsg_editable" id="productvariation_weight_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['weight']); ?></span></td>
|
|
|
183 |
<?php } ?>
|
|
|
184 |
<?php if ($this->hasMod('wpsg_mod_fuellmenge')) { ?>
|
|
|
185 |
<td class="col_stock"><span class="wpsg_editable" id="productvariation_fmenge_<?php echo $vari['id']; ?>"><?php echo wpsg_hspc($vari['fmenge']); ?></span></td>
|
|
|
186 |
<?php } ?>
|
|
|
187 |
|
5583 |
daniel |
188 |
<?php } ?>
|
|
|
189 |
|
|
|
190 |
<?php if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) { ?>
|
|
|
191 |
<td class="col_action">
|
5488 |
daniel |
192 |
|
6454 |
hartmut |
193 |
<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 |
194 |
|
|
|
195 |
</td>
|
5583 |
daniel |
196 |
<?php } ?>
|
5488 |
daniel |
197 |
|
|
|
198 |
</tr>
|
7841 |
daniel |
199 |
|
6136 |
hartmut |
200 |
<tr class="wpsg_mod_productvariants_productimage_row">
|
6891 |
hartmut |
201 |
<td class="col_active"> </td>
|
6136 |
hartmut |
202 |
<?php
|
7841 |
daniel |
203 |
|
|
|
204 |
if (wpsg_isSizedInt($this->view['product_id'])) {
|
|
|
205 |
|
|
|
206 |
$arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['product_id'], $vari['id'], true);
|
|
|
207 |
|
|
|
208 |
} else {
|
|
|
209 |
|
7842 |
daniel |
210 |
$arAttachmentIDs = $vari['images'];
|
7841 |
daniel |
211 |
|
|
|
212 |
}
|
6438 |
daniel |
213 |
|
6136 |
hartmut |
214 |
?>
|
6438 |
daniel |
215 |
<td class="ui-sortable" colspan="<?php echo $colspan; ?>" id="wpsg_images_productimage_<?php echo $this->view['variant']['id']; ?>_<?php echo $vari['id']; ?>" >
|
7841 |
daniel |
216 |
|
|
|
217 |
<div class="d-flex justify-content-between w-100">
|
|
|
218 |
|
|
|
219 |
<div>
|
|
|
220 |
<?php foreach ($arAttachmentIDs as $attachment_id) { $attachment_id = intval($attachment_id); ?>
|
|
|
221 |
|
|
|
222 |
<?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
|
|
|
223 |
|
|
|
224 |
<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']; ?>);">
|
|
|
225 |
<?php echo wp_get_attachment_image($attachment_id, array(25, 25), true); ?>
|
|
|
226 |
</a>
|
|
|
227 |
|
|
|
228 |
<?php } else { ?>
|
|
|
229 |
|
|
|
230 |
<a href="#" class="pic wpsg_mod_productvariants_remove_global_vari_image"
|
|
|
231 |
data-variant_id="<?php echo intval($_REQUEST['variant_id']); ?>"
|
|
|
232 |
data-variation_id="<?php echo $vari['id']; ?>"
|
|
|
233 |
data-attachment_id="<?php echo $attachment_id; ?>"
|
|
|
234 |
>
|
|
|
235 |
<?php echo wp_get_attachment_image($attachment_id, array(25, 25), true); ?>
|
|
|
236 |
<span><span class="glyphicon glyphicon-trash"></span></span>
|
|
|
237 |
</a>
|
|
|
238 |
|
|
|
239 |
<?php } ?>
|
|
|
240 |
|
|
|
241 |
<?php } ?>
|
|
|
242 |
</div>
|
|
|
243 |
|
|
|
244 |
<?php if (!wpsg_isSizedInt($this->view['product_id'])) { ?>
|
|
|
245 |
<div>
|
|
|
246 |
|
|
|
247 |
<input id="media_upload_<?php echo $vari['id']; ?>" value="<?php echo __('Mediathek', 'wpsg'); ?>" class="button" type="button" />
|
|
|
248 |
|
|
|
249 |
</div>
|
|
|
250 |
<?php } ?>
|
|
|
251 |
|
|
|
252 |
</div>
|
7849 |
daniel |
253 |
|
|
|
254 |
<?php if ($this->hasMod('wpsg_mod_downloadplus')) { ?>
|
|
|
255 |
<div>
|
|
|
256 |
|
|
|
257 |
<?php
|
|
|
258 |
|
|
|
259 |
$arTemplates = $this->callMod('wpsg_mod_downloadplus', 'getTemplate', []);
|
|
|
260 |
$arTemplatesLabel = [
|
|
|
261 |
|
|
|
262 |
];
|
|
|
263 |
|
|
|
264 |
foreach ($arTemplates as $t) $arTemplatesLabel[intval($t['id'])] = $t['name'];
|
|
|
265 |
|
|
|
266 |
?>
|
|
|
267 |
|
|
|
268 |
<span title="<?php echo __('Templatevorgabe für PDF Anpassungen mit DownloadPlus', 'wpsg'); ?>" class="wpsg_editable" id="productvariation_template_<?php echo $vari['id']; ?>"><?php
|
|
|
269 |
|
|
|
270 |
$template_id = intval($vari['template_id']);
|
|
|
271 |
|
|
|
272 |
if ($template_id > 0 && isset($arTemplatesLabel[$template_id])) echo $arTemplatesLabel[$template_id];
|
|
|
273 |
else __('Unverändert', 'wpsg');
|
|
|
274 |
|
|
|
275 |
?></span>
|
|
|
276 |
|
|
|
277 |
<script>
|
|
|
278 |
|
|
|
279 |
jQuery('#productvariation_template_<?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', {
|
|
|
280 |
submitdata: {
|
|
|
281 |
field: 'template_id',
|
|
|
282 |
field_id: '<?php echo $vari['id']; ?>'
|
|
|
283 |
},
|
|
|
284 |
data: <?php echo wpsg_prepare_for_inlineEdit($arTemplatesLabel); ?>,
|
|
|
285 |
type: 'select'
|
|
|
286 |
});
|
|
|
287 |
|
|
|
288 |
</script>
|
|
|
289 |
|
|
|
290 |
</div>
|
|
|
291 |
<?php } ?>
|
6094 |
hartmut |
292 |
|
7841 |
daniel |
293 |
<script>
|
6136 |
hartmut |
294 |
|
6438 |
daniel |
295 |
jQuery(document).ready(function() {
|
7841 |
daniel |
296 |
|
|
|
297 |
<?php if (intval($this->view['product_id']) <= 0) { ?>
|
|
|
298 |
document.getElementById('media_upload_<?php echo $vari['id']; ?>').addEventListener('click', (event) => {
|
|
|
299 |
|
|
|
300 |
event.preventDefault();
|
|
|
301 |
|
|
|
302 |
wpsg_mod_productvariants_vari_id = <?php echo $vari['id']; ?>;
|
|
|
303 |
|
|
|
304 |
if (wpframe !== undefined) { wpframe.open(); return; }
|
|
|
305 |
|
|
|
306 |
wpframe = wp.media.frames.file_frame = wp.media({
|
|
|
307 |
title: "<?php echo __('Auswählen oder Hochladen von Medien', 'wpsg'); ?>",
|
|
|
308 |
button: { text: "<?php echo __('Medien benutzen', 'wpsg'); ?>" },
|
|
|
309 |
multiple: true
|
|
|
310 |
});
|
|
|
311 |
|
|
|
312 |
wpframe.on('select', () => {
|
|
|
313 |
|
|
|
314 |
let arAtt = [];
|
|
|
315 |
let attachments = wpframe.state().get('selection').map((attachment) => {
|
|
|
316 |
|
|
|
317 |
attachment.toJSON();
|
|
|
318 |
|
|
|
319 |
arAtt.push(attachment.id);
|
|
|
320 |
|
|
|
321 |
return attachment;
|
|
|
322 |
|
|
|
323 |
});
|
|
|
324 |
|
|
|
325 |
jQuery('#wpsg_mod_productvariants_dialog_modal .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
|
|
|
326 |
|
|
|
327 |
jQuery.ajax({
|
|
|
328 |
url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_upload&noheader=1',
|
|
|
329 |
async: true,
|
|
|
330 |
data: {
|
|
|
331 |
product_id: '<?php echo intval($_REQUEST['product_id']); ?>',
|
|
|
332 |
variant_id: '<?php echo intval($_REQUEST['variant_id']); ?>',
|
|
|
333 |
vari_id: wpsg_mod_productvariants_vari_id,
|
|
|
334 |
arAtt: arAtt
|
|
|
335 |
},
|
|
|
336 |
success: function(data) {
|
|
|
337 |
|
|
|
338 |
jQuery('#wpsg_mod_productvariants_dialog_modal .modal-body').html(data);
|
|
|
339 |
|
|
|
340 |
}
|
|
|
341 |
});
|
|
|
342 |
|
|
|
343 |
});
|
|
|
344 |
|
|
|
345 |
wpframe.open();
|
|
|
346 |
|
|
|
347 |
});
|
|
|
348 |
<?php } ?>
|
|
|
349 |
|
|
|
350 |
<?php if (intval($this->view['product_id']) > 0) { ?>
|
6438 |
daniel |
351 |
jQuery('#wpsg_images_productimage_<?php echo $this->view['variant']['id']; ?>_<?php echo $vari['id']; ?>').sortable( {
|
6136 |
hartmut |
352 |
items: 'a',
|
|
|
353 |
helper : 'clone',
|
|
|
354 |
update: function(event, ui) {
|
|
|
355 |
|
|
|
356 |
wpsg_vp_ajaxloading_show();
|
|
|
357 |
|
|
|
358 |
var wpsg_reorder = jQuery(this).sortable('toArray');
|
6438 |
daniel |
359 |
|
6136 |
hartmut |
360 |
jQuery.ajax( {
|
|
|
361 |
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']; ?>',
|
|
|
362 |
async: false,
|
|
|
363 |
data: {
|
6438 |
daniel |
364 |
'var_id': <?php echo $this->view['variant']['id']; ?>,
|
|
|
365 |
'vari_id': <?php echo $vari['id']; ?>,
|
6136 |
hartmut |
366 |
'wpsg_reorder': wpsg_reorder
|
|
|
367 |
},
|
|
|
368 |
success: function(data) {
|
|
|
369 |
|
|
|
370 |
if (data != '1') alert(data);
|
6438 |
daniel |
371 |
|
6136 |
hartmut |
372 |
wpsg_vp_ajaxloading_hide();
|
|
|
373 |
|
|
|
374 |
}
|
|
|
375 |
} );
|
|
|
376 |
|
|
|
377 |
}
|
7841 |
daniel |
378 |
} ).disableSelection();
|
|
|
379 |
<?php } ?>
|
6136 |
hartmut |
380 |
|
|
|
381 |
} );
|
|
|
382 |
|
6438 |
daniel |
383 |
</script>
|
|
|
384 |
|
|
|
385 |
</td>
|
|
|
386 |
|
5488 |
daniel |
387 |
</tr>
|
5490 |
daniel |
388 |
|
5488 |
daniel |
389 |
</tbody>
|
|
|
390 |
<?php } ?>
|
|
|
391 |
|
|
|
392 |
</table>
|
|
|
393 |
|
7841 |
daniel |
394 |
<script>
|
5488 |
daniel |
395 |
|
6438 |
daniel |
396 |
function wpsg_vp_vari_setPic(htmlElement, var_id, vari_id, attachment_id, product_id)
|
6094 |
hartmut |
397 |
{
|
|
|
398 |
|
|
|
399 |
<?php if (!isset($_REQUEST['wpsg_lang'])) { ?>
|
|
|
400 |
|
|
|
401 |
wpsg_vp_ajaxloading_show();
|
6438 |
daniel |
402 |
|
6094 |
hartmut |
403 |
jQuery.ajax( {
|
|
|
404 |
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']; ?>",
|
|
|
405 |
async: false,
|
|
|
406 |
data: {
|
|
|
407 |
var_id: var_id,
|
|
|
408 |
vari_id: vari_id,
|
6438 |
daniel |
409 |
product_id: product_id,
|
|
|
410 |
attachment_id: attachment_id
|
6094 |
hartmut |
411 |
},
|
|
|
412 |
success: function(data) {
|
6438 |
daniel |
413 |
|
|
|
414 |
jQuery(htmlElement).toggleClass('mark');
|
|
|
415 |
|
6094 |
hartmut |
416 |
wpsg_vp_ajaxloading_hide();
|
|
|
417 |
|
|
|
418 |
}
|
|
|
419 |
} );
|
|
|
420 |
|
|
|
421 |
<?php } ?>
|
|
|
422 |
|
|
|
423 |
return false;
|
|
|
424 |
|
|
|
425 |
}
|
|
|
426 |
|
|
|
427 |
function wpsg_vp_ajaxloading_show()
|
|
|
428 |
{
|
|
|
429 |
|
6136 |
hartmut |
430 |
jQuery('.wpsg_mod_productvariants_ajaxloading').show();
|
6094 |
hartmut |
431 |
|
|
|
432 |
}
|
|
|
433 |
|
|
|
434 |
function wpsg_vp_ajaxloading_hide()
|
|
|
435 |
{
|
|
|
436 |
|
6136 |
hartmut |
437 |
jQuery('.wpsg_mod_productvariants_ajaxloading').hide();
|
6094 |
hartmut |
438 |
|
|
|
439 |
}
|
|
|
440 |
|
|
|
441 |
|
6149 |
hartmut |
442 |
<?php
|
|
|
443 |
$b1 = wpsg_isSizedInt($this->view['product_id']);
|
|
|
444 |
$b2 = wpsg_isSizedInt($this->view['variant']['product_id']);
|
|
|
445 |
if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) {
|
6094 |
hartmut |
446 |
?>
|
6149 |
hartmut |
447 |
<?php
|
|
|
448 |
$p1 = wpsg_getInt($this->view['product_id']);
|
|
|
449 |
$p2 = ($this->view['variant']['product_id']);
|
|
|
450 |
?>
|
5488 |
daniel |
451 |
|
|
|
452 |
jQuery('.wpsg_mod_productvariants_table_variation').sortable( {
|
|
|
453 |
items: 'tbody',
|
|
|
454 |
helper: wpsg_Tablefix,
|
|
|
455 |
update: function(event, ui) {
|
|
|
456 |
|
|
|
457 |
var wpsg_reorder = jQuery(this).sortable('toArray');
|
|
|
458 |
var product_id = jQuery('#wpsg_mod_productvariants_product_id').val();
|
6149 |
hartmut |
459 |
|
5488 |
daniel |
460 |
jQuery.ajax( {
|
|
|
461 |
url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1',
|
|
|
462 |
data: {
|
|
|
463 |
'field': 'vari_pos',
|
|
|
464 |
'value': jQuery(this).sortable('toArray'),
|
|
|
465 |
'product_id': product_id
|
|
|
466 |
},
|
|
|
467 |
success: function(data) { }
|
|
|
468 |
} );
|
|
|
469 |
|
|
|
470 |
}
|
|
|
471 |
} ).disableSelection();
|
|
|
472 |
|
|
|
473 |
<?php } ?>
|
|
|
474 |
|
|
|
475 |
<?php if (wpsg_isSizedInt($this->view['variant']['product_id']) || !wpsg_isSizedInt($this->view['product_id'])) { ?>
|
|
|
476 |
jQuery('#wpsg_mod_productvariants_variation_add_button').show();
|
|
|
477 |
<?php } else { ?>
|
|
|
478 |
jQuery('#wpsg_mod_productvariants_variation_add_button').hide();
|
|
|
479 |
<?php } ?>
|
7841 |
daniel |
480 |
|
|
|
481 |
jQuery('.wpsg_mod_productvariants_remove_global_vari_image').on('click', function() {
|
|
|
482 |
|
|
|
483 |
let el = jQuery(this);
|
|
|
484 |
|
|
|
485 |
event.preventDefault();
|
|
|
486 |
|
|
|
487 |
if (!confirm('<?php echo __('Sind Sie sich sicher?', 'wpsg'); ?>')) return;
|
|
|
488 |
|
|
|
489 |
el.remove();
|
|
|
490 |
|
|
|
491 |
jQuery.ajax({
|
|
|
492 |
url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_removeImage&noheader=1',
|
|
|
493 |
async: true,
|
|
|
494 |
data: {
|
|
|
495 |
product_id: 0,
|
|
|
496 |
variant_id: el.data('variant_id'),
|
|
|
497 |
vari_id: el.data('variation_id'),
|
|
|
498 |
attachment_id: el.data('attachment_id')
|
|
|
499 |
},
|
|
|
500 |
success: function(data) { }
|
|
|
501 |
});
|
|
|
502 |
|
|
|
503 |
});
|
|
|
504 |
|
|
|
505 |
</script>
|
7849 |
daniel |
506 |
|
5488 |
daniel |
507 |
<?php if (!wpsg_isSizedInt($this->view['product_id'])) { ?>
|
|
|
508 |
<p class="wpsg_hinweis"><?php echo __('Reihenfolge kann mittels Drag&Drop verändert werden.', 'wpsg'); ?></p>
|
|
|
509 |
<?php } ?>
|
|
|
510 |
|
|
|
511 |
<?php } else { ?>
|
5583 |
daniel |
512 |
|
|
|
513 |
<?php echo __('Bisher keine Variationen der Variante angelegt.', 'wpsg'); ?>
|
|
|
514 |
|
7841 |
daniel |
515 |
<script>
|
5583 |
daniel |
516 |
|
|
|
517 |
<?php if (wpsg_isSizedInt($this->view['variant']['product_id']) || !wpsg_isSizedInt($this->view['product_id'])) { ?>
|
|
|
518 |
jQuery('.wpsg_mod_productvariants_variation_add_button').show();
|
|
|
519 |
<?php } else { ?>
|
|
|
520 |
jQuery('.wpsg_mod_productvariants_variation_add_button').hide();
|
|
|
521 |
<?php } ?>
|
|
|
522 |
|
7841 |
daniel |
523 |
</script>
|
5583 |
daniel |
524 |
|
7841 |
daniel |
525 |
<?php } ?>
|
|
|
526 |
|