示例#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>';
         }
     }
 }
示例#2
0
 /**
  * This function is used to get the all feartured product page from db.
  *
  * 
  * 
  * @return string
  */
 function getAllFeatured()
 {
     $sql = "SELECT a.*,sum(c.rating)/count(c.user_id) as rating FROM `products_table` a left join product_reviews_table c on a.product_id=c.product_id WHERE category_id IN (SELECT b.category_id AS id FROM category_table a INNER JOIN category_table b ON a.category_id = b.category_parent_id ORDER BY rand()) and is_featured=1 and a.status=1 and a.intro_date <= '" . date('Y-m-d') . "' group by a.product_id limit 0,3";
     $query = new Bin_Query();
     if ($query->executeQuery($sql)) {
         $flag = '0';
         $j = 0;
         $cnt = count($query->records);
         if ($cnt > 0) {
             for ($i = 0; $i < $cnt; $i++) {
                 foreach ($query->records as $row) {
                     $r[$j] = $row;
                     $prid = $row['product_id'];
                     $minval = Core_CWishList::disRates($prid);
                     if ($minval > 0 or $minval != '') {
                         $r[$j]['msrp'] = '$' . number_format($row['msrp'], 2) . ' - $' . number_format($minval, 2);
                     } else {
                         $r[$j]['msrp'] = '$' . number_format($row['msrp'], 2);
                     }
                     $j++;
                 }
             }
             $output = Display_DFeaturedItems::showFeaturedItems($query->records, $flag, $r);
         }
     } else {
         $flag = '1';
         $j = 0;
         $cnt = count($query->records);
         if ($cnt > 0) {
             for ($i = 0; $i < $cnt; $i++) {
                 foreach ($query->records as $row) {
                     $r[$j] = $row;
                     $prid = $row['product_id'];
                     $minval = Core_CWishList::disRates($prid);
                     if ($minval > 0 or $minval != '') {
                         $r[$j]['msrp'] = '$' . number_format($row['msrp'], 2) . ' - $' . number_format($minval, 2);
                     } else {
                         $r[$j]['msrp'] = '$' . number_format($row['msrp'], 2);
                     }
                     $j++;
                 }
             }
             $output = Display_DFeaturedItems::showFeaturedItems($query->records, $flag, $r);
         }
     }
     return $output;
 }
示例#3
0
 /**
  * Function gets all the product details for the selected category id 
  * 
  * 
  * @return string
  */
 function showProducts()
 {
     if ($_GET['id'] != '') {
         $_SESSION['catid'] = $_GET['id'];
         $sql1 = "SELECT category_id,subcat_path from category_table WHERE FIND_IN_SET(" . $_GET['id'] . ",subcat_path)";
         $res1 = mysql_query($sql1);
         while ($row1 = mysql_fetch_array($res1)) {
             $fromdate = $row1['category_id'];
             $result[] = $fromdate;
         }
         $categoryid = implode(',', $result);
         $sql = "SELECT * FROM products_table where category_id  IN({$categoryid})";
         $query = new Bin_Query();
         if ($query->executeQuery($sql)) {
             $totrows = $query->totrows;
         }
         if ($totrows > 0) {
             return Display_DFeaturedItems::productList($query->records);
         } else {
             return Display_DFeaturedItems::productList($query->records);
         }
     } else {
         return 'Select SubCategory';
     }
 }