GX-Abgewiesen #41408 » Eigenschaften-Performance-Fix.patch
| src/system/classes/properties/PropertiesDataAgent.inc.php (revision ) | ||
|---|---|---|
| 1 | 1 |
<?php |
| 2 | 2 |
/* -------------------------------------------------------------- |
| 3 |
PropertiesDataAgent.inc.php 2015-05-27 gambio
|
|
| 3 |
PropertiesDataAgent.inc.php 2015-06-25 gambio
|
|
| 4 | 4 |
Gambio GmbH |
| 5 | 5 |
http://www.gambio.de |
| 6 | 6 |
Copyright (c) 2015 Gambio GmbH |
| ... | ... | |
| 328 | 328 |
$t_min_quantity_string = ''; |
| 329 | 329 |
if(($t_use_properties_combis_quantity == 0 && STOCK_CHECK == 'true' && ATTRIBUTE_STOCK_CHECK == 'true') || $t_use_properties_combis_quantity == 2) |
| 330 | 330 |
{
|
| 331 |
$t_min_quantity_string = 'AND ppc.combi_quantity >= ' . $t_products_min_quantity;
|
|
| 331 |
$t_min_quantity_string = 'AND ppc.combi_quantity >= ' . xtc_db_input($t_products_min_quantity);
|
|
| 332 | 332 |
} |
| 333 | 333 |
if(STOCK_ALLOW_CHECKOUT == 'true' || $c_check_quantity == false) |
| 334 | 334 |
{
|
| ... | ... | |
| 338 | 338 |
$t_pv_in_string = ''; |
| 339 | 339 |
if(is_array($p_selected_values) && count($p_selected_values) > 0) |
| 340 | 340 |
{
|
| 341 |
$t_pv_in_string = ' ppcv.properties_values_id IN (' . implode(',', $p_selected_values) . ') AND ';
|
|
| 341 |
foreach($p_selected_values as $values_id) |
|
| 342 |
{
|
|
| 343 |
$t_pv_in_string .= " ppc.combis_values_string LIKE '%-" . xtc_db_input($values_id) . "-%' AND "; |
|
| 342 |
} |
|
| 344 |
} |
|
| 345 |
} |
|
| 343 | 346 |
|
| 344 | 347 |
$t_available_combis_ids = array(); |
| 348 |
|
|
| 349 |
if(is_array($p_selected_values) && count($p_selected_values) > 0) |
|
| 350 |
{
|
|
| 345 |
$t_query = 'SELECT
|
|
| 346 |
ppc.products_properties_combis_id
|
|
| 347 |
FROM
|
|
| 351 |
$t_query = 'SELECT |
|
| 352 |
ppc.products_properties_combis_id |
|
| 353 |
FROM |
|
| 348 |
products_properties_combis_values AS ppcv |
|
| 349 |
LEFT JOIN
|
|
| 350 |
products_properties_combis AS ppc ON ppc.products_properties_combis_id = ppcv.products_properties_combis_id
|
|
| 354 |
products_properties_combis AS ppc |
|
| 351 |
WHERE |
|
| 352 |
' . $t_pv_in_string . ' |
|
| 353 |
ppc.products_id = "' . $c_products_id . '" |
|
| 355 |
WHERE
|
|
| 356 |
' . $t_pv_in_string . '
|
|
| 357 |
ppc.products_id = "' . $c_products_id . '"
|
|
| 354 |
' . $t_min_quantity_string . ' |
|
| 355 |
GROUP BY |
|
| 356 |
ppc.products_properties_combis_id'; |
|
| 357 |
if(is_array($p_selected_values) && count($p_selected_values) > 0) |
|
| 358 |
' . $t_min_quantity_string ;
|
|
| 359 |
}
|
|
| 360 |
else |
|
| 358 | 361 |
{
|
| 359 |
$t_query .= |
|
| 360 |
' HAVING |
|
| 361 |
COUNT(ppcv.products_properties_combis_values_id) = ' . count($p_selected_values); |
|
| 362 |
$t_query = 'SELECT products_properties_combis_id FROM products_properties_combis WHERE products_id = "' . $c_products_id . '"'; |
|
| 362 | 363 |
} |
| 363 | 364 |
$t_result = xtc_db_query($t_query); |
| 364 | 365 |
while($t_row = xtc_db_fetch_array($t_result)) |
| ... | ... | |
| 378 | 379 |
|
| 379 | 380 |
if(is_array($p_select_properties) && count($p_select_properties) > 0) |
| 380 | 381 |
{
|
| 381 |
$t_query = 'SELECT |
|
| 382 |
ppcv.properties_values_id
|
|
| 382 |
$t_query = 'SELECT DISTINCT
|
|
| 383 |
properties_values_id |
|
| 383 | 384 |
FROM |
| 384 |
products_properties_combis_values AS ppcv |
|
| 385 |
LEFT JOIN |
|
| 386 |
properties_values AS pv USING (properties_values_id) |
|
| 385 |
products_properties_index |
|
| 387 | 386 |
WHERE |
| 388 |
pv.properties_id IN (' . implode(',', array_keys($p_select_properties)) . ')
|
|
| 387 |
properties_id IN (' . implode(',', array_keys($p_select_properties)) . ')
|
|
| 389 | 388 |
AND products_properties_combis_id IN (' . implode(',', $p_combis_is_array) . ')';
|
| 390 | 389 |
} |
| 391 | 390 |
else |
| 392 | 391 |
{
|
| 393 |
$t_query = 'SELECT |
|
| 392 |
$t_query = 'SELECT DISTINCT
|
|
| 394 | 393 |
properties_values_id |
| 395 | 394 |
FROM |
| 396 |
products_properties_combis_values
|
|
| 395 |
products_properties_index
|
|
| 397 | 396 |
WHERE |
| 398 | 397 |
products_properties_combis_id IN (' . implode(',', $p_combis_is_array) . ')';
|
| 399 | 398 |
} |
| ... | ... | |
| 403 | 402 |
{
|
| 404 | 403 |
$t_values_ids_array[] = $t_row['properties_values_id']; |
| 405 | 404 |
} |
| 406 |
$t_values_ids_array = array_unique($t_values_ids_array); |
|
| 405 |
|
|
| 407 | 406 |
return $t_values_ids_array; |
| 408 | 407 |
} |
| 409 | 408 |
|
| src/system/classes/properties/PropertiesCombisAdminControl.inc.php (revision ) | ||
|---|---|---|
| 1 | 1 |
<?php |
| 2 | 2 |
/* -------------------------------------------------------------- |
| 3 |
PropertiesCombisAdminControl.inc.php 2014-02-02 tb@gambio
|
|
| 3 |
PropertiesCombisAdminControl.inc.php 2015-06-25 tb@gambio
|
|
| 4 | 4 |
Gambio GmbH |
| 5 | 5 |
http://www.gambio.de |
| 6 |
Copyright (c) 2014 Gambio GmbH
|
|
| 6 |
Copyright (c) 2015 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 |
-------------------------------------------------------------- |
| ... | ... | |
| 209 | 209 |
(products_properties_combis_id, properties_values_id) VALUES |
| 210 | 210 |
'; |
| 211 | 211 |
|
| 212 |
$t_values_string = ''; |
|
| 213 |
|
|
| 212 | 214 |
for($i = 0, $total = count($p_properties_values_array); $i < $total; $i++) |
| 213 | 215 |
{
|
| 214 | 216 |
$t_sql .= '('.$c_properties_combis_id.', '.(int)$p_properties_values_array[$i].')';
|
| ... | ... | |
| 216 | 218 |
$t_sql .= ', |
| 217 | 219 |
'; |
| 218 | 220 |
} |
| 221 |
|
|
| 222 |
$t_values_string .= '-'.(int)$p_properties_values_array[$i].'-'; |
|
| 223 |
|
|
| 219 | 224 |
} |
| 220 | 225 |
$t_sql .= ';'; |
| 221 | 226 |
|
| 227 |
xtc_db_query("UPDATE products_properties_combis SET combis_values_string='".$t_values_string."' WHERE products_properties_combis_id=".$c_properties_combis_id);
|
|
| 228 |
|
|
| 222 | 229 |
xtc_db_query($t_sql); |
| 223 | 230 |
|
| 224 | 231 |
return true; |
| ... | ... | |
| 481 | 488 |
'8' => array(78, 76, 84) |
| 482 | 489 |
);*/ |
| 483 | 490 |
# find highest given sort_order |
| 484 |
$coo_data_group = MainFactory::create_object('GMDataObjectGroup', array('products_properties_combis', array('products_id' => $p_products_id), array('sort_order DESC') ));
|
|
| 485 |
$t_data_array = $coo_data_group->get_data_objects_array(); |
|
| 491 |
$t_sql = "SELECT max(sort_order) as sort_order FROM products_properties_combis WHERE products_id=".$c_products_id; |
|
| 492 |
$t_result = xtc_db_query($t_sql); |
|
| 493 |
$t_data_array = xtc_db_fetch_array($t_result); |
|
| 486 |
|
|
| 494 |
|
|
| 487 | 495 |
# set start sort_order |
| 488 | 496 |
if(sizeof($t_data_array) == 0) {
|
| 489 | 497 |
$t_sort_order = 1; |
| 490 | 498 |
} else {
|
| 491 |
$t_sort_order = $t_data_array[0]->get_data_value('sort_order') + 1;
|
|
| 499 |
$t_sort_order = $t_data_array['sort_order'] + 1;
|
|
| 492 | 500 |
} |
| 501 |
|
|
| 493 | 502 |
# get all possible combis |
| 494 | 503 |
$t_all_combis_array = $this->get_combined_ids($p_properties_values_ids_array, $p_actual_index); |
| 495 | 504 |
|