Example #1
0
 public function getShopProductDetails()
 {
     $this->qry = Product::Select(DB::raw("product.id, product.product_status, product.total_downloads, product.url_slug, product.product_user_id, product.product_sold, product.product_added_date,\n\t\t\t\t\t\t\t\t\t   product.product_category_id, product.product_tags, product.is_free_product, product.total_views, product.product_discount_price, product.product_discount_fromdate,\n\t\t\t\t\t\t\t\t\t   product.product_discount_todate, product.product_price, product.product_name, product.product_description, product.product_highlight_text,\n\t\t\t\t\t\t\t\t\t   product.date_activated, NOW() as date_current, IF( ( DATE( NOW() ) BETWEEN product.product_discount_fromdate AND product.product_discount_todate), 1, 0 ) AS have_discount,\n\t\t\t\t\t\t\t\t\t   product.product_price_currency, product.product_price_usd, product.product_discount_price_usd"));
     $this->qry->whereRaw('product.product_status = ? AND product.product_user_id = ?', array('Ok', $this->shop_owner_id));
     if (Input::get("section_id") != "") {
         if (is_numeric(Input::get("section_id"))) {
             $this->qry->join('user_product_section', 'user_product_section.id', '=', 'product.user_section_id')->whereRaw("( user_product_section.id = " . Input::get("section_id") . " )");
         }
     }
     $this->qry->orderBy("product.id", 'DESC');
     return $this->qry;
 }
Example #2
0
 public static function populateShopProducts($user_code)
 {
     $product_arr = array();
     $messageAddService = new MessageAddService();
     //Get User id from user code
     $user_id = CUtil::getUserId($user_code);
     if ($user_id > 0) {
         $product_details = Product::whereRaw('product_user_id =  ?', array($user_id))->get(array('product_name', 'id'));
         $product_arr[""] = trans("webshoppack::common.select_option");
         if (count($product_details) > 0) {
             foreach ($product_details as $product) {
                 $product_arr[$product['id']] = $product['product_name'];
             }
         }
         return $product_arr;
     }
 }