spencermjax Posted August 12, 2006 Share Posted August 12, 2006 I had someone develop a custom search page for my site. I am having trouble getting in touch with that person. I am now hoping someone here may be able to help. Here is the search page: search page link probably the most important issue to note is that I have category fields contribution installed(shape, color, clarity). rather than having radio buttons I would like to have check boxes so several options could be selected. currently when I change the radio buttons to checkboxes, results are only given for the last checkbox checked. Here is the code that I think may be part of the equation. It comes from advanced_search.php (my page is named diamond_search): <!-- color_array --> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => HEADING_SEARCH_CRITERIA); new infoBoxHeading($info_box_contents, true, true); //color $color = array(E, F, G, H, I, J, K, L); $radioboxes = ' ' . tep_draw_radio_field('Color', 'D', true) . tep_draw_separator('pixel_trans.gif', '16', '10'); foreach($color as $key) { $radioboxes .= ' ' . tep_draw_radio_field('Color', $key, false) . tep_draw_separator('pixel_trans.gif', '21', '10'); } $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => $radioboxes); // $info_box_contents[] = array('align' => 'left', 'text' => tep_draw_checkbox_field('search_in_description', '1') . ' ' . TEXT_SEARCH_IN_DESCRIPTION); new infoBox($info_box_contents); ?> I am not sure how much of this will be needed so I will paste the entier advanced_search_result.php file (diamond_search_result.php): <?php /* $Id: advanced_search_result.php,v 1.72 2003/06/23 06:50:11 project3000 Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ADVANCED_SEARCH); $error = false; $pfrom = ''; $pto = ''; $wfrom = ''; $pto = ''; if (isset($HTTP_GET_VARS['pfrom'])) { $pfrom = $HTTP_GET_VARS['pfrom']; } if (isset($HTTP_GET_VARS['pto'])) { $pto = $HTTP_GET_VARS['pto']; } if (isset($HTTP_GET_VARS['wfrom'])) { $wfrom = $HTTP_GET_VARS['wfrom']; } if (isset($HTTP_GET_VARS['wto'])) { $wto = $HTTP_GET_VARS['wto']; } if (tep_not_null($pto)) { if (!settype($pto, 'double')) { $error = true; $price_check_error = true; $messageStack->add_session('search', ERROR_PRICE_TO_MUST_BE_NUM); } } if (($price_check_error == false) && is_float($pfrom) && is_float($pto)) { if ($pfrom >= $pto) { $error = true; $messageStack->add_session('search', ERROR_PRICE_TO_LESS_THAN_PRICE_FROM); } } if ($error == true) { tep_redirect(tep_href_link(FILENAME_DIAMOND_SEARCH, tep_get_all_get_params(), 'NONSSL', true, false)); } $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_DIAMOND_SEARCH)); $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_DIAMOND_SEARCH_RESULT, tep_get_all_get_params(), 'NONSSL', true, false)); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <!-- body_text //--> <td width="100%" valign="top" class="bg2a" height="512"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading2"><?php echo HEADING_TITLE_2; ?></td> </tr> </table><br> <table border="0" width="97%" cellspacing="0" cellpadding="0" align="center"> <tr> <td ><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td width="95%" align="center" > <?php // create column list $define_list = array('DIAMOND_LIST_MODEL' => DIAMOND_LIST_MODEL, 'DIAMOND_LIST_SHAPE' => DIAMOND_LIST_SHAPE, 'DIAMOND_LIST_COLOR' => DIAMOND_LIST_COLOR, 'DIAMOND_LIST_PRICE' => DIAMOND_LIST_PRICE, 'DIAMOND_LIST_CLARITY' => DIAMOND_LIST_CLARITY, 'DIAMOND_LIST_WEIGHT' => DIAMOND_LIST_WEIGHT); asort($define_list); $column_list = array(); reset($define_list); while (list($key, $value) = each($define_list)) { if ($value > 0) $column_list[] = $key; } $select_column_list = ''; for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { switch ($column_list[$i]) { case 'DIAMOND_LIST_MODEL': $select_column_list .= 'p.products_model, '; break; case 'DIAMOND_LIST_WEIGHT': $select_column_list .= 'p.products_weight, '; break; } } // Extra Fields $field = '\'' . $HTTP_GET_VARS['Color'] . '\', '; if ($HTTP_GET_VARS['Clarity'] != 'search') { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['Clarity'] . '\' '; $fcount = 3; } else { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\' '; $fcount = 2; } $fields = rtrim($field, ','); $select_str = "select distinct " . $select_column_list . " p.products_id, p.products_image, pd.products_name, p.products_price, p.products_quantity, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price "; if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) { $select_str .= ", SUM(tr.tax_rate) as tax_rate "; } // $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " p2pef on p.products_id = p2pef.products_id left join "? . TABLE_PRODUCTS_EXTRA_FIELDS . " pef on pef.products_extra_fields_id = p2pef.products_extra_fields_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_MANUFACTURERS . " m on m.manufacturers_id=p.manufacturers_id"; $from_str = "from " . TABLE_PRODUCTS . " p inner join " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " p2pef on p.products_id=p2pef.products_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id"; if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) { if (!tep_session_is_registered('customer_country_id')) { $customer_country_id = STORE_COUNTRY; $customer_zone_id = STORE_ZONE; } $from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')"; } $from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c"; $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '29' and p.products_id = p2c.products_id "; if (tep_not_null($pfrom)) { if ($currencies->is_set($currency)) { $rate = $currencies->get_value($currency); $pfrom = $pfrom / $rate; } } if (tep_not_null($pto)) { if (isset($rate)) { $pto = $pto / $rate; } } if (DISPLAY_PRICE_WITH_TAX == 'true') { if ($pfrom > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) >= " . (double)$pfrom . ")"; if ($pto > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) <= " . (double)$pto . ")"; } else { if ($pfrom > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) >= " . (double)$pfrom . ")"; if ($pto > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) <= " . (double)$pto . ")"; } if ($wfrom != 'search') { if ($wfrom > 0) $where_str .= " and (p.products_weight >= " . (double)$wfrom . ")"; if ($wto > 0) $where_str .= " and (p.products_weight <= " . (double)$wto . ")"; } $where_str .= " and p2pef.products_extra_fields_value IN (" . $fields . ")"; $where_str .= " group by p.products_id having count(p2pef.products_extra_fields_value) = " . $fcount . ""; if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) { for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { if ($column_list[$i] == 'PRODUCT_LIST_NAME') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $order_str = ' order by pd.products_name'; break; } } } else { $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1); $sort_order = substr($HTTP_GET_VARS['sort'], 1); $order_str = ' order by '; switch ($column_list[$sort_col-1]) { case 'DIAMOND_LIST_MODEL': $order_str .= "p.products_model " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'DIAMOND_LIST_NAME': $order_str .= "pd.products_name " . ($sort_order == 'd' ? "desc" : ""); break; case 'DIAMOND_LIST_MANUFACTURER': $order_str .= "m.manufacturers_name " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'DIAMOND_LIST_QUANTITY': $order_str .= "p.products_quantity " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'DIAMOND_LIST_IMAGE': $order_str .= "pd.products_name"; break; case 'DIAMOND_LIST_WEIGHT': $order_str .= "p.products_weight " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'DIAMOND_LIST_PRICE': $order_str .= "final_price " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; } } $listing_sql = $select_str . $from_str . $where_str . $order_str; require(DIR_WS_INCLUDES . 'classes/splitpageresults2.php'); require(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING_DIAMONDS); ?> </td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DIAMOND_SEARCH, tep_get_all_get_params(array('sort', 'page')), 'NONSSL', true, false) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td> </tr> </table></td> <!-- body_text_eof //--> </tr> <tr> <td><img src="images/m26.gif"> </td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Link to comment Share on other sites More sharing options...
boxtel Posted August 12, 2006 Share Posted August 12, 2006 I had someone develop a custom search page for my site. I am having trouble getting in touch with that person. I am now hoping someone here may be able to help.Here is the search page: search page link probably the most important issue to note is that I have category fields contribution installed(shape, color, clarity). rather than having radio buttons I would like to have check boxes so several options could be selected. currently when I change the radio buttons to checkboxes, results are only given for the last checkbox checked. Here is the code that I think may be part of the equation. It comes from advanced_search.php (my page is named diamond_search): <!-- color_array --> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => HEADING_SEARCH_CRITERIA); new infoBoxHeading($info_box_contents, true, true); //color $color = array(E, F, G, H, I, J, K, L); $radioboxes = ' ' . tep_draw_radio_field('Color', 'D', true) . tep_draw_separator('pixel_trans.gif', '16', '10'); foreach($color as $key) { $radioboxes .= ' ' . tep_draw_radio_field('Color', $key, false) . tep_draw_separator('pixel_trans.gif', '21', '10'); } $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => $radioboxes); // $info_box_contents[] = array('align' => 'left', 'text' => tep_draw_checkbox_field('search_in_description', '1') . ' ' . TEXT_SEARCH_IN_DESCRIPTION); new infoBox($info_box_contents); ?> I am not sure how much of this will be needed so I will paste the entier advanced_search_result.php file (diamond_search_result.php): <?php /* $Id: advanced_search_result.php,v 1.72 2003/06/23 06:50:11 project3000 Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ADVANCED_SEARCH); $error = false; $pfrom = ''; $pto = ''; $wfrom = ''; $pto = ''; if (isset($HTTP_GET_VARS['pfrom'])) { $pfrom = $HTTP_GET_VARS['pfrom']; } if (isset($HTTP_GET_VARS['pto'])) { $pto = $HTTP_GET_VARS['pto']; } if (isset($HTTP_GET_VARS['wfrom'])) { $wfrom = $HTTP_GET_VARS['wfrom']; } if (isset($HTTP_GET_VARS['wto'])) { $wto = $HTTP_GET_VARS['wto']; } if (tep_not_null($pto)) { if (!settype($pto, 'double')) { $error = true; $price_check_error = true; $messageStack->add_session('search', ERROR_PRICE_TO_MUST_BE_NUM); } } if (($price_check_error == false) && is_float($pfrom) && is_float($pto)) { if ($pfrom >= $pto) { $error = true; $messageStack->add_session('search', ERROR_PRICE_TO_LESS_THAN_PRICE_FROM); } } if ($error == true) { tep_redirect(tep_href_link(FILENAME_DIAMOND_SEARCH, tep_get_all_get_params(), 'NONSSL', true, false)); } $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_DIAMOND_SEARCH)); $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_DIAMOND_SEARCH_RESULT, tep_get_all_get_params(), 'NONSSL', true, false)); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <!-- body_text //--> <td width="100%" valign="top" class="bg2a" height="512"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading2"><?php echo HEADING_TITLE_2; ?></td> </tr> </table><br> <table border="0" width="97%" cellspacing="0" cellpadding="0" align="center"> <tr> <td ><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td width="95%" align="center" > <?php // create column list $define_list = array('DIAMOND_LIST_MODEL' => DIAMOND_LIST_MODEL, 'DIAMOND_LIST_SHAPE' => DIAMOND_LIST_SHAPE, 'DIAMOND_LIST_COLOR' => DIAMOND_LIST_COLOR, 'DIAMOND_LIST_PRICE' => DIAMOND_LIST_PRICE, 'DIAMOND_LIST_CLARITY' => DIAMOND_LIST_CLARITY, 'DIAMOND_LIST_WEIGHT' => DIAMOND_LIST_WEIGHT); asort($define_list); $column_list = array(); reset($define_list); while (list($key, $value) = each($define_list)) { if ($value > 0) $column_list[] = $key; } $select_column_list = ''; for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { switch ($column_list[$i]) { case 'DIAMOND_LIST_MODEL': $select_column_list .= 'p.products_model, '; break; case 'DIAMOND_LIST_WEIGHT': $select_column_list .= 'p.products_weight, '; break; } } // Extra Fields $field = '\'' . $HTTP_GET_VARS['Color'] . '\', '; if ($HTTP_GET_VARS['Clarity'] != 'search') { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['Clarity'] . '\' '; $fcount = 3; } else { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\' '; $fcount = 2; } $fields = rtrim($field, ','); $select_str = "select distinct " . $select_column_list . " p.products_id, p.products_image, pd.products_name, p.products_price, p.products_quantity, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price "; if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) { $select_str .= ", SUM(tr.tax_rate) as tax_rate "; } // $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " p2pef on p.products_id = p2pef.products_id left join "? . TABLE_PRODUCTS_EXTRA_FIELDS . " pef on pef.products_extra_fields_id = p2pef.products_extra_fields_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_MANUFACTURERS . " m on m.manufacturers_id=p.manufacturers_id"; $from_str = "from " . TABLE_PRODUCTS . " p inner join " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " p2pef on p.products_id=p2pef.products_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id"; if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) { if (!tep_session_is_registered('customer_country_id')) { $customer_country_id = STORE_COUNTRY; $customer_zone_id = STORE_ZONE; } $from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')"; } $from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c"; $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '29' and p.products_id = p2c.products_id "; if (tep_not_null($pfrom)) { if ($currencies->is_set($currency)) { $rate = $currencies->get_value($currency); $pfrom = $pfrom / $rate; } } if (tep_not_null($pto)) { if (isset($rate)) { $pto = $pto / $rate; } } if (DISPLAY_PRICE_WITH_TAX == 'true') { if ($pfrom > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) >= " . (double)$pfrom . ")"; if ($pto > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) <= " . (double)$pto . ")"; } else { if ($pfrom > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) >= " . (double)$pfrom . ")"; if ($pto > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) <= " . (double)$pto . ")"; } if ($wfrom != 'search') { if ($wfrom > 0) $where_str .= " and (p.products_weight >= " . (double)$wfrom . ")"; if ($wto > 0) $where_str .= " and (p.products_weight <= " . (double)$wto . ")"; } $where_str .= " and p2pef.products_extra_fields_value IN (" . $fields . ")"; $where_str .= " group by p.products_id having count(p2pef.products_extra_fields_value) = " . $fcount . ""; if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) { for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { if ($column_list[$i] == 'PRODUCT_LIST_NAME') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $order_str = ' order by pd.products_name'; break; } } } else { $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1); $sort_order = substr($HTTP_GET_VARS['sort'], 1); $order_str = ' order by '; switch ($column_list[$sort_col-1]) { case 'DIAMOND_LIST_MODEL': $order_str .= "p.products_model " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'DIAMOND_LIST_NAME': $order_str .= "pd.products_name " . ($sort_order == 'd' ? "desc" : ""); break; case 'DIAMOND_LIST_MANUFACTURER': $order_str .= "m.manufacturers_name " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'DIAMOND_LIST_QUANTITY': $order_str .= "p.products_quantity " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'DIAMOND_LIST_IMAGE': $order_str .= "pd.products_name"; break; case 'DIAMOND_LIST_WEIGHT': $order_str .= "p.products_weight " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'DIAMOND_LIST_PRICE': $order_str .= "final_price " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; } } $listing_sql = $select_str . $from_str . $where_str . $order_str; require(DIR_WS_INCLUDES . 'classes/splitpageresults2.php'); require(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING_DIAMONDS); ?> </td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DIAMOND_SEARCH, tep_get_all_get_params(array('sort', 'page')), 'NONSSL', true, false) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td> </tr> </table></td> <!-- body_text_eof //--> </tr> <tr> <td><img src="images/m26.gif"> </td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> it is because the behaviour of checkboxes and radio buttons is different. a radiobutton group will always only return 1 value whereas each checkbox will do that individually. Therefore, all radiobuttons have the same name (group name) and each checkbox needs it own individual name. so you would get multiple variables in search results : with single choice : where color = radio value with multiple choice : where color = D or color = E or .....etc. so you need to check : if (isset($GET['colorD'])) $where_clause .= " and color = 'D' "; if (isset($GET['colorC'])) $where_clause .= " and color = 'C' "; if (isset($GET['colorF'])) $where_clause .= " and color = 'F' "; etc. something like that. Treasurer MFC Link to comment Share on other sites More sharing options...
boxtel Posted August 12, 2006 Share Posted August 12, 2006 it is because the behaviour of checkboxes and radio buttons is different. a radiobutton group will always only return 1 value whereas each checkbox will do that individually. Therefore, all radiobuttons have the same name (group name) and each checkbox needs it own individual name. so you would get multiple variables in search results : with single choice : where color = radio value with multiple choice : where color = D or color = E or .....etc. so you need to check : if (isset($GET['colorD'])) $where_clause .= " and color = 'D' "; if (isset($GET['colorC'])) $where_clause .= " and color = 'C' "; if (isset($GET['colorF'])) $where_clause .= " and color = 'F' "; etc. something like that. better use or instead of and ofcourse Treasurer MFC Link to comment Share on other sites More sharing options...
spencermjax Posted August 14, 2006 Author Share Posted August 14, 2006 ok, I have tried several things but nothing works. I get no results. The problem is that I don't understand the code, how it is actually working. Also, he used "$HTTP_GET_VARS['Color']" and you mentioned "if (isset($GET['colorD'])) $where_clause .= " and color = 'D' ";". I don't even know how they differ so trying to change them is usless for me. To be honest with you, I don't have a clue what to do next. I'll at least give you this if it helps. I have set up my check boxes like this: <table width="403" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><input name="colorD" type="checkbox" value="D" />?</td> <td align="center"><input name="colorE" type="checkbox" value="E" />?</td> <td align="center"><input name="colorF" type="checkbox" value="F" />?</td> <td align="center"><input name="colorG" type="checkbox" value="G" />?</td> <td align="center"><input name="colorH" type="checkbox" value="H" />?</td> <td align="center"><input name="colorI" type="checkbox" value="I" />?</td> <td align="center"><input name="colorJ" type="checkbox" value="J" />?</td> <td align="center"><input name="colorK" type="checkbox" value="K" />?</td> <td align="center"><input name="colorL" type="checkbox" value="L" />?</td> </tr> </table> I believe this is the code I need to focus on: // Extra Fields $field = '\'' . $HTTP_GET_VARS['Color'] . '\', '; if ($HTTP_GET_VARS['Clarity'] != 'search') { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['Clarity'] . '\' '; $fcount = 3; } else { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\' '; $fcount = 2; } I know this is wrong but this is the last attempt I made: $field = '\'' . $HTTP_GET_VARS['ColorD'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['ColorE'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['ColorF'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['ColorG'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['ColorH'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['ColorI'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['ColorJ'] . '\', '; $field = '\'' . $HTTP_GET_VARS['ColorK'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['ColorL'] . '\', '; if ($HTTP_GET_VARS['Clarity'] != 'search') { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['Clarity'] . '\' '; $fcount = 3; } else { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\' '; $fcount = 2; } Link to comment Share on other sites More sharing options...
boxtel Posted August 14, 2006 Share Posted August 14, 2006 ok, I have tried several things but nothing works. I get no results. The problem is that I don't understand the code, how it is actually working. Also, he used "$HTTP_GET_VARS['Color']" and you mentioned "if (isset($GET['colorD'])) $where_clause .= " and color = 'D' ";". I don't even know how they differ so trying to change them is usless for me. To be honest with you, I don't have a clue what to do next. I'll at least give you this if it helps. I have set up my check boxes like this: <table width="403" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><input name="colorD" type="checkbox" value="D" /> </td> <td align="center"><input name="colorE" type="checkbox" value="E" /> </td> <td align="center"><input name="colorF" type="checkbox" value="F" /> </td> <td align="center"><input name="colorG" type="checkbox" value="G" /> </td> <td align="center"><input name="colorH" type="checkbox" value="H" /> </td> <td align="center"><input name="colorI" type="checkbox" value="I" /> </td> <td align="center"><input name="colorJ" type="checkbox" value="J" /> </td> <td align="center"><input name="colorK" type="checkbox" value="K" /> </td> <td align="center"><input name="colorL" type="checkbox" value="L" /> </td> </tr> </table> I believe this is the code I need to focus on: // Extra Fields $field = '\'' . $HTTP_GET_VARS['Color'] . '\', '; if ($HTTP_GET_VARS['Clarity'] != 'search') { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['Clarity'] . '\' '; $fcount = 3; } else { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\' '; $fcount = 2; } I know this is wrong but this is the last attempt I made: $field = '\'' . $HTTP_GET_VARS['ColorD'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['ColorE'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['ColorF'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['ColorG'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['ColorH'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['ColorI'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['ColorJ'] . '\', '; $field = '\'' . $HTTP_GET_VARS['ColorK'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['ColorL'] . '\', '; if ($HTTP_GET_VARS['Clarity'] != 'search') { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['Clarity'] . '\' '; $fcount = 3; } else { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\' '; $fcount = 2; } Well, as I would handle it: you have the checkboxes in your search form so they should be ok. the in advanced search result you need to check which box was checked and from that extend the query. For easy handling I would put them in an array if checked and then use the "in" operator for mysql which avoids the need to write elaborate and (color = 'B' or color = 'F' .......) constructions. in the section where the "where clause" is amended a lot (you see several " $where_str .= " statements) you can add: // declare array $color_array = array(); // add color codes if requested if (isset($_GET['colorD']) && ($_GET['colorD'] == '1')) $color_array[] = 'D'; if (isset($_GET['colorE']) && ($_GET['colorE'] == '1')) $color_array[] = 'E'; if (isset($_GET['colorF']) && ($_GET['colorF'] == '1')) $color_array[] = 'F'; if (isset($_GET['colorG']) && ($_GET['colorG'] == '1')) $color_array[] = 'G'; if (isset($_GET['colorH']) && ($_GET['colorH'] == '1')) $color_array[] = 'H'; if (isset($_GET['colorI']) && ($_GET['colorI'] == '1')) $color_array[] = 'I'; if (isset($_GET['colorJ']) && ($_GET['colorJ'] == '1')) $color_array[] = 'J'; if (isset($_GET['colorK']) && ($_GET['colorK'] == '1')) $color_array[] = 'K'; if (isset($_GET['colorL']) && ($_GET['colorL'] == '1')) $color_array[] = 'L'; // if any color codes requested, amend the where clause if (sizeof($color_array) > 0) { $where_str .= " and color in ('" . implode("','", $color_array) . "') "; } this would result in teh addition of the where clause with for instance: " and color in ('E','B','C') " assuming that "color" is your database field holding that value for the products. You may have to alter $_GET to $HTTP_GET_VARS. Treasurer MFC Link to comment Share on other sites More sharing options...
spencermjax Posted August 14, 2006 Author Share Posted August 14, 2006 Thank you for all of your help!! How does your code effect the first line of the code below? $field = '\'' . $HTTP_GET_VARS['Color'] . '\', '; if ($HTTP_GET_VARS['Clarity'] != 'search') { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['Clarity'] . '\' '; $fcount = 3; } else { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\' '; $fcount = 2; } I have also tried placing the code you gave me in several different places but I can't get it to work. I just keep getting no results. Link to comment Share on other sites More sharing options...
boxtel Posted August 15, 2006 Share Posted August 15, 2006 Thank you for all of your help!! How does your code effect the first line of the code below? $field = '\'' . $HTTP_GET_VARS['Color'] . '\', '; if ($HTTP_GET_VARS['Clarity'] != 'search') { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\', '; $field .= '\'' . $HTTP_GET_VARS['Clarity'] . '\' '; $fcount = 3; } else { $field .= '\'' . $HTTP_GET_VARS['Shape'] . '\' '; $fcount = 2; } I have also tried placing the code you gave me in several different places but I can't get it to work. I just keep getting no results. ah, you are using this extra fields stuff. that is not a very handy implementation when it comes to directed searches. what it does is simply search all extra field values for the values given. So you have shape=round and color=H and it will compare ALL extra values with both regardless of what the fields mean. it creates a string 'Round','H' and then use : $where_str .= " and p2pef.products_extra_fields_value IN (" . $fields . ")"; so where any of the fields has Round or H as value. so if you were to have 2 different extra fields which could have the same value, you have incorrect results. and you already have that, choose color G and it will also show Clarity G as a result, probably a data error but it shows the example very clearly. Treasurer MFC Link to comment Share on other sites More sharing options...
boxtel Posted August 15, 2006 Share Posted August 15, 2006 ah, you are using this extra fields stuff. that is not a very handy implementation when it comes to directed searches. what it does is simply search all extra field values for the values given. So you have shape=round and color=H and it will compare ALL extra values with both regardless of what the fields mean. it creates a string 'Round','H' and then use : $where_str .= " and p2pef.products_extra_fields_value IN (" . $fields . ")"; so where any of the fields has Round or H as value. so if you were to have 2 different extra fields which could have the same value, you have incorrect results. and you already have that, choose color G and it will also show Clarity G as a result, probably a data error but it shows the example very clearly. well, you could replace that field stuff with: // declare array $field_array = array(); // add extra fields if requested if (isset($HTTP_GET_VARS['colorD']) && ($HTTP_GET_VARS['colorD'] == '1')) $field_array[] = 'D'; if (isset($HTTP_GET_VARS['colorE']) && ($HTTP_GET_VARS['colorE'] == '1')) $field_array[] = 'E'; if (isset($HTTP_GET_VARS['colorF']) && ($HTTP_GET_VARS['colorF'] == '1')) $field_array[] = 'F'; if (isset($HTTP_GET_VARS['colorG']) && ($HTTP_GET_VARS['colorG'] == '1')) $field_array[] = 'G'; if (isset($HTTP_GET_VARS['colorH']) && ($HTTP_GET_VARS['colorH'] == '1')) $field_array[] = 'H'; if (isset($HTTP_GET_VARS['colorI']) && ($HTTP_GET_VARS['colorI'] == '1')) $field_array[] = 'I'; if (isset($HTTP_GET_VARS['colorJ']) && ($HTTP_GET_VARS['colorJ'] == '1')) $field_array[] = 'J'; if (isset($HTTP_GET_VARS['colorK']) && ($HTTP_GET_VARS['colorK'] == '1')) $field_array[] = 'K'; if (isset($HTTP_GET_VARS['colorL']) && ($HTTP_GET_VARS['colorL'] == '1')) $field_array[] = 'L'; if ($HTTP_GET_VARS['Clarity'] != 'search') { $field_array[] = $HTTP_GET_VARS['Shape']; $field_array[] = $HTTP_GET_VARS['Clarity']; $fcount = 3; } else { $field_array[] = $HTTP_GET_VARS['Shape']; $fcount = 2; } then replace this where stuff : $where_str .= " and p2pef.products_extra_fields_value IN (" . $fields . ")"; $where_str .= " group by p.products_id having count(p2pef.products_extra_fields_value) = " . $fcount . ""; with: if (sizeof($field_array) > 0) { $where_str .= " and p2pef.products_extra_fields_value in ('" . implode("','", $field_array) . "') "; $where_str .= " group by p.products_id having count(p2pef.products_extra_fields_value) = " . $fcount. " "; } but this still will make the query look for these values in any of your extra fields so it would also popup clarity = H (if you would have that) eventhough color H was requested. Treasurer MFC Link to comment Share on other sites More sharing options...
spencermjax Posted August 15, 2006 Author Share Posted August 15, 2006 well, I tried that but it is not working. I would be willing to pay either one of you to have access to these files and fix them for me. The person I previously paid to do the search feature is actually the same person who developed the category fields contribution. Link to comment Share on other sites More sharing options...
boxtel Posted August 15, 2006 Share Posted August 15, 2006 well, I tried that but it is not working. I would be willing to pay either one of you to have access to these files and fix them for me. The person I previously paid to do the search feature is actually the same person who developed the category fields contribution. you now have this in your url: colorE=E&colorG=G&colorJ=J it is expecting : colorE=1&colorG=1&colorJ=1 so make the values 1, a checkbox is either not checked or checked. The person I previously paid to do the search feature is actually the same person who developed the category fields contribution. and this is no surprise. normally, to do it good, you would have to separate the value groups and only compare colors in the value if the name is color, same for shape etc. now you are comparing everything with everything. That works as long as those values can never be the same among groups. Treasurer MFC Link to comment Share on other sites More sharing options...
spencermjax Posted August 15, 2006 Author Share Posted August 15, 2006 do you mean <input name="colorD" type="checkbox" value="1" /> rather then <input name="colorD" type="checkbox" value="D" /> Link to comment Share on other sites More sharing options...
spencermjax Posted August 15, 2006 Author Share Posted August 15, 2006 WOW!!! That worked. I owe ya one! I may end up owing you a couple more if you keep visiting this thread. I will now try to "copy" the code you gave me and use it for the diamond shapes. While I'm doing that is there any reason you know of that that would not be a good idea? Link to comment Share on other sites More sharing options...
spencermjax Posted August 15, 2006 Author Share Posted August 15, 2006 OK, I just added the Shape portion similar to the color portion you gave me: // declare array $field_array = array(); // add extra fields if requested //shape if (isset($HTTP_GET_VARS['Cushette']) && ($HTTP_GET_VARS['Cushette'] == '1')) $field_array[] = 'Cushette'; if (isset($HTTP_GET_VARS['Emerald']) && ($HTTP_GET_VARS['Emerald'] == '1')) $field_array[] = 'Emerald'; if (isset($HTTP_GET_VARS['Heart']) && ($HTTP_GET_VARS['Heart'] == '1')) $field_array[] = 'Heart'; if (isset($HTTP_GET_VARS['Marquise']) && ($HTTP_GET_VARS['Marquise'] == '1')) $field_array[] = 'Marquise'; if (isset($HTTP_GET_VARS['Oval']) && ($HTTP_GET_VARS['Oval'] == '1')) $field_array[] = 'Oval'; if (isset($HTTP_GET_VARS['Pear']) && ($HTTP_GET_VARS['Pear'] == '1')) $field_array[] = 'Pear'; if (isset($HTTP_GET_VARS['Princess']) && ($HTTP_GET_VARS['Princess'] == '1')) $field_array[] = 'Princess'; if (isset($HTTP_GET_VARS['Radiant']) && ($HTTP_GET_VARS['Radiant'] == '1')) $field_array[] = 'Radiant'; if (isset($HTTP_GET_VARS['Round']) && ($HTTP_GET_VARS['Round'] == '1')) $field_array[] = 'Round'; if (isset($HTTP_GET_VARS['Trillion']) && ($HTTP_GET_VARS['Trillion'] == '1')) $field_array[] = 'Trillion'; //color if (isset($HTTP_GET_VARS['colorD']) && ($HTTP_GET_VARS['colorD'] == '1')) $field_array[] = 'D'; if (isset($HTTP_GET_VARS['colorE']) && ($HTTP_GET_VARS['colorE'] == '1')) $field_array[] = 'E'; if (isset($HTTP_GET_VARS['colorF']) && ($HTTP_GET_VARS['colorF'] == '1')) $field_array[] = 'F'; if (isset($HTTP_GET_VARS['colorG']) && ($HTTP_GET_VARS['colorG'] == '1')) $field_array[] = 'G'; if (isset($HTTP_GET_VARS['colorH']) && ($HTTP_GET_VARS['colorH'] == '1')) $field_array[] = 'H'; if (isset($HTTP_GET_VARS['colorI']) && ($HTTP_GET_VARS['colorI'] == '1')) $field_array[] = 'I'; if (isset($HTTP_GET_VARS['colorJ']) && ($HTTP_GET_VARS['colorJ'] == '1')) $field_array[] = 'J'; if (isset($HTTP_GET_VARS['colorK']) && ($HTTP_GET_VARS['colorK'] == '1')) $field_array[] = 'K'; if (isset($HTTP_GET_VARS['colorL']) && ($HTTP_GET_VARS['colorL'] == '1')) $field_array[] = 'L'; I am assuming the $where_str changes will stay the same. BUT what do I need to do with this: if ($HTTP_GET_VARS['Clarity'] != 'search') { $field_array[] = $HTTP_GET_VARS['Shape']; $field_array[] = $HTTP_GET_VARS['Clarity']; $fcount = 3; } else { $field_array[] = $HTTP_GET_VARS['Shape']; $fcount = 2; } Link to comment Share on other sites More sharing options...
spencermjax Posted August 15, 2006 Author Share Posted August 15, 2006 I got booted off when I tried to edit the above post. I am posting it again here because I think this may be a bit more clear. OK, I just added the Shape portion similar to the color portion you gave me (see below). It seems to be working right if I checkat least one shape and atleast one color but...... ----If I do a search and do not check a shape I get no results ----If I do a search and do not check a color I get no results ----If I do a search and do not check a shape and do not check a color I get no results I think it may have something to do with this: if ($HTTP_GET_VARS['Clarity'] != 'search') { $field_array[] = $HTTP_GET_VARS['Shape']; $field_array[] = $HTTP_GET_VARS['Clarity']; $fcount = 3; } else { $field_array[] = $HTTP_GET_VARS['Shape']; $fcount = 2; } Here is the additional array cose I added: // declare array $field_array = array(); // add extra fields if requested //shape if (isset($HTTP_GET_VARS['Cushette']) && ($HTTP_GET_VARS['Cushette'] == '1')) $field_array[] = 'Cushette'; if (isset($HTTP_GET_VARS['Emerald']) && ($HTTP_GET_VARS['Emerald'] == '1')) $field_array[] = 'Emerald'; if (isset($HTTP_GET_VARS['Heart']) && ($HTTP_GET_VARS['Heart'] == '1')) $field_array[] = 'Heart'; if (isset($HTTP_GET_VARS['Marquise']) && ($HTTP_GET_VARS['Marquise'] == '1')) $field_array[] = 'Marquise'; if (isset($HTTP_GET_VARS['Oval']) && ($HTTP_GET_VARS['Oval'] == '1')) $field_array[] = 'Oval'; if (isset($HTTP_GET_VARS['Pear']) && ($HTTP_GET_VARS['Pear'] == '1')) $field_array[] = 'Pear'; if (isset($HTTP_GET_VARS['Princess']) && ($HTTP_GET_VARS['Princess'] == '1')) $field_array[] = 'Princess'; if (isset($HTTP_GET_VARS['Radiant']) && ($HTTP_GET_VARS['Radiant'] == '1')) $field_array[] = 'Radiant'; if (isset($HTTP_GET_VARS['Round']) && ($HTTP_GET_VARS['Round'] == '1')) $field_array[] = 'Round'; if (isset($HTTP_GET_VARS['Trillion']) && ($HTTP_GET_VARS['Trillion'] == '1')) $field_array[] = 'Trillion'; //color if (isset($HTTP_GET_VARS['colorD']) && ($HTTP_GET_VARS['colorD'] == '1')) $field_array[] = 'D'; if (isset($HTTP_GET_VARS['colorE']) && ($HTTP_GET_VARS['colorE'] == '1')) $field_array[] = 'E'; if (isset($HTTP_GET_VARS['colorF']) && ($HTTP_GET_VARS['colorF'] == '1')) $field_array[] = 'F'; if (isset($HTTP_GET_VARS['colorG']) && ($HTTP_GET_VARS['colorG'] == '1')) $field_array[] = 'G'; if (isset($HTTP_GET_VARS['colorH']) && ($HTTP_GET_VARS['colorH'] == '1')) $field_array[] = 'H'; if (isset($HTTP_GET_VARS['colorI']) && ($HTTP_GET_VARS['colorI'] == '1')) $field_array[] = 'I'; if (isset($HTTP_GET_VARS['colorJ']) && ($HTTP_GET_VARS['colorJ'] == '1')) $field_array[] = 'J'; if (isset($HTTP_GET_VARS['colorK']) && ($HTTP_GET_VARS['colorK'] == '1')) $field_array[] = 'K'; if (isset($HTTP_GET_VARS['colorL']) && ($HTTP_GET_VARS['colorL'] == '1')) $field_array[] = 'L'; I am still assuming the $where_str changes will stay the same. Link to comment Share on other sites More sharing options...
spencermjax Posted August 18, 2006 Author Share Posted August 18, 2006 Here is where I stand. I have shape, color & clarity all with check boxes. Clarity has 5 checkboxes so lets say the first clarity box is checked, two entries are added to the array. What is happening.... - if I select one of the shape checkboxes & no color & no clarity.....The results include all diamonds for that shape - if I select one of the color checkboxes & no shape & no clarity.....The results include all diamonds for that color - if I select one of the clarity checkboxes & no shape & no color.....The results include all diamonds for that clarity - if I select all of the shape checkboxes & no color & no clarity.....The results include all diamonds - if I select all of the color checkboxes & no shape & no clarity.....The results include all diamonds - if I select all of the clarity checkboxes & no shape & no color.....The results include all diamonds - if I select any combination of shape, color or clarity checkboxes.....I get no results HERE IS MY CODE: Should you need to see more of the code, please let me know. This portion is checking for which checkboxes are checked // Extra Fields // declare array $field_array = array(); $field_array2 = array(); $field_array3 = array(); // add extra fields if requested //shape if (isset($HTTP_GET_VARS['Cushette']) && ($HTTP_GET_VARS['Cushette'] == '1')) $field_array[] = 'Cushette';$fcount = 1; if (isset($HTTP_GET_VARS['Emerald']) && ($HTTP_GET_VARS['Emerald'] == '1')) $field_array[] = 'Emerald';$fcount = 1; if (isset($HTTP_GET_VARS['Heart']) && ($HTTP_GET_VARS['Heart'] == '1')) $field_array[] = 'Heart';$fcount = 1; if (isset($HTTP_GET_VARS['Marquise']) && ($HTTP_GET_VARS['Marquise'] == '1')) $field_array[] = 'Marquise';$fcount = 1; if (isset($HTTP_GET_VARS['Oval']) && ($HTTP_GET_VARS['Oval'] == '1')) $field_array[] = 'Oval';$fcount = 1; if (isset($HTTP_GET_VARS['Pear']) && ($HTTP_GET_VARS['Pear'] == '1')) $field_array[] = 'Pear';$fcount = 1; if (isset($HTTP_GET_VARS['Princess']) && ($HTTP_GET_VARS['Princess'] == '1')) $field_array[] = 'Princess';$fcount = 1; if (isset($HTTP_GET_VARS['Radiant']) && ($HTTP_GET_VARS['Radiant'] == '1')) $field_array[] = 'Radiant';$fcount = 1; if (isset($HTTP_GET_VARS['Round']) && ($HTTP_GET_VARS['Round'] == '1')) $field_array[] = 'Round';$fcount = 1; if (isset($HTTP_GET_VARS['Trillion']) && ($HTTP_GET_VARS['Trillion'] == '1')) $field_array[] = 'Trillion';$fcount = 1; //color if (isset($HTTP_GET_VARS['colorD']) && ($HTTP_GET_VARS['colorD'] == '1')) $field_array2[] = 'D';$fcount = 2; if (isset($HTTP_GET_VARS['colorE']) && ($HTTP_GET_VARS['colorE'] == '1')) $field_array2[] = 'E';$fcount = 2; if (isset($HTTP_GET_VARS['colorF']) && ($HTTP_GET_VARS['colorF'] == '1')) $field_array2[] = 'F';$fcount = 2; if (isset($HTTP_GET_VARS['colorG']) && ($HTTP_GET_VARS['colorG'] == '1')) $field_array2[] = 'G';$fcount = 2; if (isset($HTTP_GET_VARS['colorH']) && ($HTTP_GET_VARS['colorH'] == '1')) $field_array2[] = 'H';$fcount = 2; if (isset($HTTP_GET_VARS['colorI']) && ($HTTP_GET_VARS['colorI'] == '1')) $field_array2[] = 'I';$fcount = 2; if (isset($HTTP_GET_VARS['colorJ']) && ($HTTP_GET_VARS['colorJ'] == '1')) $field_array2[] = 'J';$fcount = 2; if (isset($HTTP_GET_VARS['colorK']) && ($HTTP_GET_VARS['colorK'] == '1')) $field_array2[] = 'K';$fcount = 2; if (isset($HTTP_GET_VARS['colorL']) && ($HTTP_GET_VARS['colorL'] == '1')) $field_array2[] = 'L';$fcount = 2; //Clarity if (isset($HTTP_GET_VARS['a']) && ($HTTP_GET_VARS['a'] == '1')) { $field_array3[] = 'FL'; $fcount = 3; } if (isset($HTTP_GET_VARS['a']) && ($HTTP_GET_VARS['a'] == '1')) { $field_array3[] = 'IF'; $fcount = 3; } if (isset($HTTP_GET_VARS['b']) && ($HTTP_GET_VARS['b'] == '1')){ $field_array3[] = 'VVS1'; $fcount = 3; } if (isset($HTTP_GET_VARS['b']) && ($HTTP_GET_VARS['b'] == '1')){ $field_array3[] = 'VVS2'; $fcount = 3; } if (isset($HTTP_GET_VARS['c']) && ($HTTP_GET_VARS['c'] == '1')){ $field_array3[] = 'VS1'; $fcount = 3; } if (isset($HTTP_GET_VARS['c']) && ($HTTP_GET_VARS['c'] == '1')){ $field_array3[] = 'VS2'; $fcount = 3; } if (isset($HTTP_GET_VARS['d']) && ($HTTP_GET_VARS['d'] == '1')){ $field_array3[] = 'SI1'; $fcount = 3; } if (isset($HTTP_GET_VARS['d']) && ($HTTP_GET_VARS['d'] == '1')){ $field_array3[] = 'SI2'; $fcount = 3; } if (isset($HTTP_GET_VARS['e']) && ($HTTP_GET_VARS['e'] == '1')) { $field_array3[] = 'I3'; $fcount = 3; } if (isset($HTTP_GET_VARS['e']) && ($HTTP_GET_VARS['e'] == '1')) { $field_array3[] = 'I1'; $fcount = 3; } if (isset($HTTP_GET_VARS['e']) && ($HTTP_GET_VARS['e'] == '1')) { $field_array3[] = 'I2'; $fcount = 3; } if (isset($HTTP_GET_VARS['e']) && ($HTTP_GET_VARS['e'] == '1')) { $field_array3[] = 'I3'; $fcount = 3; } Here is the select portion (I believe this is where my problem may be): $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '29' and p.products_id = p2c.products_id "; ........................pricing/special pricing code here......................... if (sizeof($field_array) > 0) { $where_str .= " and p2pef.products_extra_fields_value in ('" . implode("','", $field_array) . "') "; } if (sizeof($field_array2) > 0) { $where_str .= " and p2pef.products_extra_fields_value in ('" . implode("','", $field_array2) . "') "; } if (sizeof($field_array3) > 0) { $where_str .= " and p2pef.products_extra_fields_value in ('" . implode("','", $field_array3) . "') "; } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.