function setAppliedFilters() { $category_sql = $this->current_category_id != 0 ? "and s2c.categories_id = '" . $this->current_category_id . "'" : ''; // Check for filters on each applicable Specification $specs_query_raw = "SELECT\n s.specifications_id,\n s.filter_class,\n s.products_column_name,\n sd.specification_name\n FROM\n " . TABLE_SPECIFICATION . " AS s\n INNER JOIN " . TABLE_SPECIFICATION_GROUPS . " AS sg\n ON s.specification_group_id = sg.specification_group_id\n INNER JOIN " . TABLE_SPECIFICATIONS_TO_CATEGORIES . " AS s2c\n ON sg.specification_group_id = s2c.specification_group_id\n INNER JOIN " . TABLE_SPECIFICATION_DESCRIPTION . " sd \n ON sd.specifications_id = s.specifications_id\n WHERE\n s.show_filter = 'True'\n AND sg.show_filter = 'True' \n " . $category_sql . "\n "; $specs_query = vam_db_query($specs_query_raw); while ($specs_array = vam_db_fetch_array($specs_query)) { // Retrieve the GET vars used as filters // Variable names are the letter "f" followed by the specifications_id for that spec. $var = $specs_array['specifications_id']; ${$var} = '0'; if (isset($_GET['f' . $var]) && $_GET['f' . $var] != '') { // Decode the URL-encoded names, including arrays ${$var} = vam_decode_recursive($_GET['f' . $var]); // Sanitize variables to prevent hacking ${$var} = vam_clean_get__recursive(${$var}); // Set the cporrect variable type (All _GET variables are strings by default) ${$var} = vam_set_type(${$var}); $this->applied_filters[$var] = ${$var}; } // if (isset ($_GET[$var] } // while ($specs_array }
$except_section = " AND s.specifications_id <> 52"; } $specs_query_raw = "select s.specifications_id,\n s.products_column_name,\n s.filter_class,\n s.filter_show_all,\n s.filter_display,\n sd.specification_name,\n sd.specification_prefix,\n sd.specification_suffix\n from " . TABLE_SPECIFICATION . " s,\n " . TABLE_SPECIFICATION_DESCRIPTION . " sd,\n " . TABLE_SPECIFICATION_GROUPS . " sg,\n " . TABLE_SPECIFICATIONS_TO_CATEGORIES . " s2c\n where s.specification_group_id = sg.specification_group_id\n and sg.specification_group_id = s2c.specification_group_id\n and sd.specifications_id = s.specifications_id\n " . $get_category . "\n and s.show_filter = 'True'\n and sg.show_filter = 'True'\n and sd.language_id = '" . $_SESSION['languages_id'] . "'\n " . $except_section . "\n order by s.specification_sort_order,\n sd.specification_name\n "; // print $specs_query_raw . "<br>\n"; $specs_query = vamDBquery($specs_query_raw); $first = true; while ($specs_array = vam_db_fetch_array($specs_query, true)) { // Retrieve the GET vars, sanitize, and assign to variables // Variable names are the letter "f" followed by the specifications_id for that spec. $var = 'f' . $specs_array['specifications_id']; ${$var} = '0'; if (isset($_GET[$var]) && $_GET[$var] != '') { // Decode the URL-encoded names, including arrays ${$var} = vam_decode_recursive($_GET[$var]); // Sanitize variables to prevent hacking ${$var} = vam_clean_get__recursive($_GET[$var]); // Get rid of extra values if Select All is selected ${$var} = vam_select_all_override(${$var}); } $filters_query_raw = "select sf.specification_filters_id,\n sfd.filter\n from " . TABLE_SPECIFICATIONS_FILTERS . " sf,\n " . TABLE_SPECIFICATIONS_FILTERS_DESCRIPTION . " sfd\n where sfd.specification_filters_id = sf.specification_filters_id\n and sf.specifications_id = '" . (int) $specs_array['specifications_id'] . "'\n and sfd.language_id = '" . $_SESSION['languages_id'] . "'\n order by sf.filter_sort_order,\n sfd.filter\n "; // print $filters_query_raw . "<br>\n"; $filters_query = vamDBquery($filters_query_raw); $count_filters = vam_db_num_rows($filters_query, true); $filters_select_array = array(); if ($count_filters >= SPECIFICATIONS_FILTER_MINIMUM) { $filters_array = array(); if ($first == false) { $box_text .= "<br>\n"; } $first = false; $box_text .= '<b>' . $specs_array['specification_name'] . '</b><br>';
//HTML string goes into the text part of the box $specs_query_raw = "select s.specifications_id,\n s.products_column_name,\n s.filter_class,\n s.filter_show_all,\n s.filter_display,\n sd.specification_name,\n sd.specification_prefix,\n sd.specification_suffix\n from " . TABLE_SPECIFICATION . " s,\n " . TABLE_SPECIFICATION_DESCRIPTION . " sd,\n " . TABLE_SPECIFICATION_GROUPS . " sg,\n " . TABLE_SPECIFICATIONS_TO_CATEGORIES . " s2c\n where s.specification_group_id = sg.specification_group_id\n and sg.specification_group_id = s2c.specification_group_id\n and sd.specifications_id = s.specifications_id\n and s2c.categories_id = '" . $current_category_id . "'\n and s.show_filter = 'True'\n and sg.show_filter = 'True'\n and sd.language_id = '" . $_SESSION['languages_id'] . "'\n order by s.specification_sort_order,\n sd.specification_name\n "; // print $specs_query_raw . "<br>\n"; $specs_query = vamDBquery($specs_query_raw); $first = true; while ($specs_array = vam_db_fetch_array($specs_query, true)) { $box_text .= '<div class="filter">'; // Retrieve the GET vars, sanitize, and assign to variables // Variable names are the letter "f" followed by the specifications_id for that spec. $var = 'f' . $specs_array['specifications_id']; ${$var} = '0'; if (isset($_GET[$var]) && $_GET[$var] != '') { // Decode the URL-encoded names, including arrays ${$var} = vam_decode_recursive($_GET[$var]); // Sanitize variables to prevent hacking ${$var} = vam_clean_get__recursive(${$var}); // Get rid of extra values if Select All is selected ${$var} = vam_select_all_override(${$var}); } $filters_query_raw = "select sf.specification_filters_id,\n sfd.filter\n from " . TABLE_SPECIFICATIONS_FILTERS . " sf,\n " . TABLE_SPECIFICATIONS_FILTERS_DESCRIPTION . " sfd\n where sfd.specification_filters_id = sf.specification_filters_id\n and sf.specifications_id = '" . (int) $specs_array['specifications_id'] . "'\n and sfd.language_id = '" . $_SESSION['languages_id'] . "'\n order by sf.filter_sort_order,\n sfd.filter\n "; // print $filters_query_raw . "<br>\n"; $filters_query = vamDBquery($filters_query_raw); $count_filters = vam_db_num_rows($filters_query, true); $filters_select_array = array(); if ($count_filters >= SPECIFICATIONS_FILTER_MINIMUM) { $filters_array = array(); if ($first == false) { //$box_text .= "<br />\n"; } $first = false; $box_text .= '<b>' . $specs_array['specification_name'] . '</b><br />';