1 |
1 |
<?php
|
2 |
2 |
/* --------------------------------------------------------------
|
3 |
|
PropertiesCombisAdminControl.inc.php 2016-07-06
|
|
3 |
PropertiesCombisAdminControl.inc.php 2017-03-21
|
4 |
4 |
Gambio GmbH
|
5 |
5 |
http://www.gambio.de
|
6 |
|
Copyright (c) 2016 Gambio GmbH
|
|
6 |
Copyright (c) 2017 Gambio GmbH
|
7 |
7 |
Released under the GNU General Public License (Version 2)
|
8 |
8 |
[http://www.gnu.org/licenses/gpl-2.0.html]
|
9 |
9 |
--------------------------------------------------------------
|
... | ... | |
280 |
280 |
';
|
281 |
281 |
xtc_db_query($t_sql);
|
282 |
282 |
|
|
283 |
$t_admin_ids = [];
|
|
284 |
$t_sql = 'SELECT DISTINCT a.products_properties_admin_select_id,
|
|
285 |
b.products_id
|
|
286 |
FROM products_properties_admin_select a
|
|
287 |
LEFT OUTER JOIN products_properties_index AS b ON (
|
|
288 |
a.products_id = b.products_id AND
|
|
289 |
a.properties_values_id = b.properties_values_id AND
|
|
290 |
a.properties_id = b.properties_id)
|
|
291 |
WHERE b.products_id IS NULL';
|
|
292 |
$t_result = xtc_db_query($t_sql);
|
|
293 |
while($row = xtc_db_fetch_array($t_result))
|
|
294 |
{
|
|
295 |
$t_admin_ids[] = $row['products_properties_admin_select_id'];
|
|
296 |
}
|
|
297 |
|
|
298 |
if(count($t_admin_ids))
|
|
299 |
{
|
|
300 |
$t_sql = '
|
|
301 |
DELETE
|
|
302 |
FROM
|
|
303 |
products_properties_admin_select
|
|
304 |
WHERE
|
|
305 |
products_properties_admin_select_id IN (' . implode(',', $t_admin_ids) . ')';
|
|
306 |
xtc_db_query($t_sql);
|
|
307 |
}
|
|
308 |
|
283 |
309 |
return $t_return;
|
284 |
310 |
}
|
285 |
311 |
|
... | ... | |
453 |
479 |
$c_properties_values_ids_array = $p_properties_values_ids_array;
|
454 |
480 |
if(empty($c_properties_values_ids_array)) trigger_error('save_admin_select: typeof($p_properties_values_ids_array) is empty', E_USER_ERROR);
|
455 |
481 |
|
456 |
|
# remove all maybe existing selects before adding new list
|
457 |
|
$coo_select = new GMDataObject('products_properties_admin_select');
|
458 |
|
$coo_select->set_keys(array('products_id' => $c_products_id));
|
459 |
|
$coo_select->delete();
|
460 |
|
|
461 |
482 |
foreach($c_properties_values_ids_array as $t_properties_id => $t_values_ids_array)
|
462 |
483 |
{
|
463 |
484 |
foreach($t_values_ids_array as $t_values_id)
|
... | ... | |
468 |
489 |
$coo_select->set_data_value('properties_id', $t_properties_id);
|
469 |
490 |
$coo_select->set_data_value('properties_values_id', $t_values_id);
|
470 |
491 |
|
471 |
|
$coo_select->save_body_data();
|
|
492 |
$coo_select->save_body_data(true);
|
472 |
493 |
unset($coo_select);
|
473 |
494 |
}
|
474 |
495 |
}
|