Example #1
0
 /**
  * This function is used to show the best selling product
  * 
  * 
  * @return string
  */
 function showBestSellingProducts()
 {
     $sql = "SELECT orders.product_id, sum( orders.product_qty ) AS cnt , prod.title , prod.category_id , prod.thumb_image, cat.category_name, prod.msrp\n\t\t\t\tFROM order_products_table orders , products_table prod , category_table cat \n\t\t\t\tWHERE orders.product_id=prod.product_id and prod.category_id=cat.category_id and prod.intro_date <= '" . date('Y-m-d') . "' AND status=1 \n\t\t\t\tGROUP BY orders.product_id\n\t\t\t\tORDER BY cnt DESC\n\t\t\t\tLIMIT 4 ";
     $query = new Bin_Query();
     if ($query->executeQuery($sql)) {
         $output = Display_DFeaturedItems::showBestSellingProducts($query->records);
     }
     return $output;
 }