Index: src/system/classes/properties/PropertiesDataAgent.inc.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/system/classes/properties/PropertiesDataAgent.inc.php (revision bcbbda4f7fc73a14d0f8b3e0ecd8747863f1a43e) +++ src/system/classes/properties/PropertiesDataAgent.inc.php (revision ) @@ -1,6 +1,6 @@ = ' . $t_products_min_quantity; + $t_min_quantity_string = 'AND ppc.combi_quantity >= ' . xtc_db_input($t_products_min_quantity); } if(STOCK_ALLOW_CHECKOUT == 'true' || $c_check_quantity == false) { @@ -338,27 +338,28 @@ $t_pv_in_string = ''; if(is_array($p_selected_values) && count($p_selected_values) > 0) { - $t_pv_in_string = ' ppcv.properties_values_id IN (' . implode(',', $p_selected_values) . ') AND '; + foreach($p_selected_values as $values_id) + { + $t_pv_in_string .= " ppc.combis_values_string LIKE '%-" . xtc_db_input($values_id) . "-%' AND "; - } + } + } $t_available_combis_ids = array(); + + if(is_array($p_selected_values) && count($p_selected_values) > 0) + { - $t_query = 'SELECT - ppc.products_properties_combis_id - FROM + $t_query = 'SELECT + ppc.products_properties_combis_id + FROM - products_properties_combis_values AS ppcv - LEFT JOIN - products_properties_combis AS ppc ON ppc.products_properties_combis_id = ppcv.products_properties_combis_id + products_properties_combis AS ppc - WHERE - ' . $t_pv_in_string . ' - ppc.products_id = "' . $c_products_id . '" + WHERE + ' . $t_pv_in_string . ' + ppc.products_id = "' . $c_products_id . '" - ' . $t_min_quantity_string . ' - GROUP BY - ppc.products_properties_combis_id'; - if(is_array($p_selected_values) && count($p_selected_values) > 0) + ' . $t_min_quantity_string ; + } + else { - $t_query .= - ' HAVING - COUNT(ppcv.products_properties_combis_values_id) = ' . count($p_selected_values); + $t_query = 'SELECT products_properties_combis_id FROM products_properties_combis WHERE products_id = "' . $c_products_id . '"'; } $t_result = xtc_db_query($t_query); while($t_row = xtc_db_fetch_array($t_result)) @@ -378,22 +379,20 @@ if(is_array($p_select_properties) && count($p_select_properties) > 0) { - $t_query = 'SELECT - ppcv.properties_values_id + $t_query = 'SELECT DISTINCT + properties_values_id FROM - products_properties_combis_values AS ppcv - LEFT JOIN - properties_values AS pv USING (properties_values_id) + products_properties_index WHERE - pv.properties_id IN (' . implode(',', array_keys($p_select_properties)) . ') + properties_id IN (' . implode(',', array_keys($p_select_properties)) . ') AND products_properties_combis_id IN (' . implode(',', $p_combis_is_array) . ')'; } else { - $t_query = 'SELECT + $t_query = 'SELECT DISTINCT properties_values_id FROM - products_properties_combis_values + products_properties_index WHERE products_properties_combis_id IN (' . implode(',', $p_combis_is_array) . ')'; } @@ -403,7 +402,7 @@ { $t_values_ids_array[] = $t_row['properties_values_id']; } - $t_values_ids_array = array_unique($t_values_ids_array); + return $t_values_ids_array; } \ No newline at end of file Index: src/system/classes/properties/PropertiesCombisAdminControl.inc.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/system/classes/properties/PropertiesCombisAdminControl.inc.php (revision bcbbda4f7fc73a14d0f8b3e0ecd8747863f1a43e) +++ src/system/classes/properties/PropertiesCombisAdminControl.inc.php (revision ) @@ -1,9 +1,9 @@ array(78, 76, 84) );*/ # find highest given sort_order - $coo_data_group = MainFactory::create_object('GMDataObjectGroup', array('products_properties_combis', array('products_id' => $p_products_id), array('sort_order DESC') )); - $t_data_array = $coo_data_group->get_data_objects_array(); + $t_sql = "SELECT max(sort_order) as sort_order FROM products_properties_combis WHERE products_id=".$c_products_id; + $t_result = xtc_db_query($t_sql); + $t_data_array = xtc_db_fetch_array($t_result); - + # set start sort_order if(sizeof($t_data_array) == 0) { $t_sort_order = 1; } else { - $t_sort_order = $t_data_array[0]->get_data_value('sort_order') + 1; + $t_sort_order = $t_data_array['sort_order'] + 1; } + # get all possible combis $t_all_combis_array = $this->get_combined_ids($p_properties_values_ids_array, $p_actual_index); \ No newline at end of file