$this->db->select("bookings.scheduled_time,bookings.scheduled_date,customer_vehicle.car_model as vehicle_model,customer_vehicle.car_maker as vehicle_make,customer_vehicle.car_model_year as vehicle_year,customer_vehicle.vehicle_data,TRIM(concat(mechanic.first_name,' ',IFNULL(mechanic.last_name,''))) as mechanic_name,mechanic_shop.shop_name as mechanic_shop,mechanic.address,mechanic.phone,admin_users.profile_image as image,bookings.mileage,bookings.issues_selected");
$this->db->select("bookings.scheduled_time,bookings.scheduled_date,customer_vehicle.car_model as vehicle_model,customer_vehicle.car_maker as vehicle_make,customer_vehicle.car_model_year as vehicle_year,customer_vehicle.vehicle_data,TRIM(concat(mechanic.first_name,' ',IFNULL(mechanic.last_name,''))) as mechanic_name,mechanic_shop.shop_name as mechanic_shop,mechanic.address,mechanic.phone,admin_users.profile_image as image,bookings.mileage,bookings.issues_selected");
@@ -309,13 +312,15 @@ class Webservice_model extends CI_Model {
...
@@ -309,13 +312,15 @@ class Webservice_model extends CI_Model {
$respArr['message']='Booking Id is required';
$respArr['message']='Booking Id is required';
return$respArr;
return$respArr;
}
}
$this->db->select("customer_vehicle.car_model as vehicle_model,customer_vehicle.car_maker as vehicle_make,customer_vehicle.car_model_year as vehicle_year,customer_vehicle.vehicle_data,bookings.mileage,bookings.issues_selected,bookings.custom_issue_data,bookings.mechanic_id");
$this->db->select("customer_vehicle.car_model as vehicle_model,customer_vehicle.car_maker as vehicle_make,customer_vehicle.car_model_year as vehicle_year,customer_vehicle.vehicle_data,bookings.mileage,bookings.issues_selected,bookings.custom_issue_data,mechanic_booking.mechanic_id");
(CRT.product_id=PRD.product_id AND CRT.customer_id=".$postData['user_id'].")";
}
$sql=$this->db->query("SELECT COUNT(ORDS.product_id) as count,PRD.product_id FROM products PRD LEFT JOIN orders AS ORDS ON ORDS.product_id = PRD.product_id WHERE PRD.status='1' GROUP BY PRD.product_id ORDER BY count DESC $lmt ");
$sql=$this->db->query("SELECT COUNT(ORDS.product_id) as count,PRD.product_id FROM products PRD LEFT JOIN orders AS ORDS ON ORDS.product_id = PRD.product_id WHERE PRD.status='1' GROUP BY PRD.product_id ORDER BY count DESC $lmt ");
if(!empty($sql)&&$sql->num_rows()>0){
if(!empty($sql)&&$sql->num_rows()>0){
foreach($sql->result_array()as$key=>$value){
foreach($sql->result_array()as$key=>$value){
$result=$this->db->query("SELECT ROUND(AVG(REV.rating),2) AS rating,
$result=$this->db->query("SELECT ROUND(AVG(REV.rating),2) AS rating,
COUNT(REV.id) AS reviews,PRD.*,PI.image as product_image,BRND.brand_name
COUNT(REV.id) AS reviews,PRD.*,PI.image as product_image,BRND.brand_name".$cartSel."
FROM products AS PRD
FROM products AS PRD
LEFT JOIN product_images AS PI ON
LEFT JOIN product_images AS PI ON
(PI.id=(SELECT MIN(id)
(PI.id=(SELECT MIN(id)
...
@@ -1095,7 +1132,7 @@ class Webservice_model extends CI_Model {
...
@@ -1095,7 +1132,7 @@ class Webservice_model extends CI_Model {
WHERE product_id= PRD.product_id AND
WHERE product_id= PRD.product_id AND
PRD.status='1'))
PRD.status='1'))
LEFT JOIN product_rating AS REV ON REV.product_id = PRD.product_id
LEFT JOIN product_rating AS REV ON REV.product_id = PRD.product_id
JOIN product_brand AS BRND ON BRND.brand_id = PRD.brand_id
JOIN product_brand AS BRND ON BRND.brand_id = PRD.brand_id ".$cartJoin."
WHERE PRD.status='1' AND PRD.product_id =".$value['product_id']);
WHERE PRD.status='1' AND PRD.product_id =".$value['product_id']);
if(!empty($result)&&$result->num_rows()>0){
if(!empty($result)&&$result->num_rows()>0){
$result=$result->row_array();
$result=$result->row_array();
...
@@ -1122,7 +1159,7 @@ class Webservice_model extends CI_Model {
...
@@ -1122,7 +1159,7 @@ class Webservice_model extends CI_Model {
}
}
$result=$this->db->query("SELECT ROUND(AVG(REV.rating),2) AS rating,
$result=$this->db->query("SELECT ROUND(AVG(REV.rating),2) AS rating,
COUNT(REV.id) AS reviews,PRD.product_name,PRD.short_description,PRD.part_id,TRANS.id AS transId,
COUNT(REV.id) AS reviews,PRD.product_name,PRD.short_description,PRD.part_id,TRANS.id AS transId,
TRANS.status AS tranStatus,TRANS.datetime,ORD.*,PI.image as product_image
TRANS.status AS tranStatus,TRANS.datetime,ORD.*,PI.image as product_image,BRND.brand_name
FROM orders ORD
FROM orders ORD
JOIN products PRD ON ORD.product_id = PRD.product_id
JOIN products PRD ON ORD.product_id = PRD.product_id
JOIN transaction TRANS ON (ORD.order_id = TRANS.booking_id AND TRANS.payment_for= '2')
JOIN transaction TRANS ON (ORD.order_id = TRANS.booking_id AND TRANS.payment_for= '2')
...
@@ -1133,6 +1170,8 @@ class Webservice_model extends CI_Model {
...
@@ -1133,6 +1170,8 @@ class Webservice_model extends CI_Model {
FROM product_images
FROM product_images
WHERE product_id= PRD.product_id AND
WHERE product_id= PRD.product_id AND
PRD.status='1'))
PRD.status='1'))
JOIN product_brand AS BRND ON BRND.brand_id = PRD.brand_id
WHERE ORD.customer_id=".$postData['customer_id']." GROUP BY ORD.order_id ORDER BY ORD.order_id DESC $lmt");
WHERE ORD.customer_id=".$postData['customer_id']." GROUP BY ORD.order_id ORDER BY ORD.order_id DESC $lmt");