Esempio n. 1
0
 /**
  * This function is used to show the view product
  * 
  * 
  * @return string
  */
 function viewProducts()
 {
     $id = (int) $_GET['subcatid'];
     if (isset($_GET['rtype'])) {
         $get = $_GET['rtype'];
         if (array_key_exists($get, $_SESSION['search_option'])) {
             $search = $_SESSION['search_option'];
             unset($search[$get]);
             $_SESSION['search_option'] = $search;
             if ($_GET['rtype'] == "Price") {
                 $_SESSION['range'] = "";
             }
         }
     }
     if (!isset($_SESSION['search_option'])) {
         $_SESSION['search_option'] = array();
     }
     if (array_key_exists($_GET['type'], $_SESSION['search_option'])) {
         $div = '';
     } else {
         $arr = $_SESSION['search_option'];
         $arr[$_GET['type']] = $_GET['val'];
         $_SESSION['search_option'] = $arr;
         if ($_GET['type'] == 'Price') {
             $_SESSION['range'] = $_GET['range'];
         }
     }
     $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 .= " attrib_value_id=" . $val . " AND";
             }
         }
         next($searchoption);
     }
     if (is_int($id) && $id > 0) {
         $sql = 'SELECT * from products_table where';
         $sql .= ' product_id IN (';
         $sql .= Core_CFeaturedItems::evaluate($id);
         $sql .= '	)';
         $query = new Bin_Query();
         if ($query->executeQuery($sql)) {
             return Display_DFeaturedItems::viewProducts($query->records);
         } else {
             return '<div align="center"><font color="orange" size=2><b>No Records Found</b></div>';
         }
     }
 }