if ($db_type == "postgre") { $group_by = "i.item_id, i.is_sales, i.sales_price, i.properties_price, i.price"; } else { $group_by = "i.item_id"; } } $sql_params["select"] = " i.item_id "; $sql_params["group"] = $group_by; $sql_params["order"] = $s->order_by; if (preg_match("/m\\.manufacturer_name/", $s->order_by)) { // join manufacturer table to order by manufacturer_name $sql_params["brackets"] .= "("; $sql_params["join"] .= " LEFT JOIN " . $table_prefix . "manufacturers m ON i.manufacturer_id=m.manufacturer_id) "; } $ids = VA_Products::data($sql_params, VIEW_CATEGORIES_ITEMS_PERM, $records_per_page, $page_number); $all_list_products_ids = VA_Products::data($sql_params, VIEW_CATEGORIES_ITEMS_PERM); $list_products_ids = array(); for ($id = 0; $id < sizeof($all_list_products_ids); $id++) { $list_products_ids[] = $all_list_products_ids[$id]["item_id"]; } $allowed_list_products_ids = VA_Products::find_all_ids("i.item_id IN (" . $db->tosql($list_products_ids, INTEGERS_LIST) . ")", VIEW_ITEMS_PERM); $products_ids = array(); for ($id = 0; $id < sizeof($list_products_ids); $id++) { if (in_array($list_products_ids[$id], $allowed_list_products_ids)) { $products_ids[] = $list_products_ids[$id]; } } $items_where = ""; $items_ids = array(); for ($id = 0; $id < sizeof($ids); $id++) { $items_ids[] = $ids[$id]["item_id"];