/** * This function is used to show the narrow search * * * @return string */ function dispNarrow() { $id = (int) $_GET['subcatid']; if (is_int($id)) { $searchoption = $_SESSION['search_option']; $arr = ""; for ($i = 0; $i < count($searchoption); $i++) { $key = key($searchoption); $val = $searchoption[$key]; if ($key != '' && $key != 'Brand' && $key != 'Price') { if ($i != 0) { $arr .= " AND pavt.attrib_value_id=" . $val; } } next($searchoption); } $att = strlen($arr) - 2; $attr = substr($arr, 0, $att); $sql = 'SELECT attrib_id FROM category_attrib_table WHERE subcategory_id=' . $id; $query = new Bin_Query(); $query->executeQuery($sql); $cnt = count($query->records); for ($i = 0; $i < $cnt; $i++) { $sq = 'SELECT a.attrib_name,b.* FROM attribute_table a,attribute_value_table b WHERE a.attrib_id=b.attrib_id AND a.attrib_id=' . $query->records[$i]['attrib_id']; $que = new Bin_Query(); if ($que->executeQuery($sq)) { $narrowdata[] = $que->records; for ($j = 0; $j < count($narrowdata[$i]); $j++) { $sql = ' SELECT count(distinct(product_id)) as cnt FROM `product_attrib_values_table` WHERE attrib_value_id =' . $narrowdata[$i][$j]['attrib_value_id'] . ' AND '; $sql .= ' product_id IN ('; $sql .= Core_CFeaturedItems::evaluate($id); $sql .= ' )'; $que = new Bin_Query(); $que->executeQuery($sql); $narrowdata[$i][$j]['products_count'] = $que->records[0]['cnt']; } } } return Display_DFeaturedItems::displayNarrow($narrowdata); } }