get sellers by top review ratings
« on: July 30, 2023, 09:47:13 AM »
I want to get the seller by rating(which seller has more ratings will rank on top)
ex. 
XYZ user has rated 4.8 stars by 1 user
abc seller has rated 4.3 stars by 4 user


then seller orders are
1. abc
2. xyz

here are i am trying to

public function getTable_Rating() {
  return DB_TABLE_PREFIX.'t_user_rating_ur';
}


if($order == 'ITEMS') {
    $this->dao->join($this->getTable_user() . ' as uv', '(b.fk_i_user_id = uv.pk_i_id)', 'INNER');
    $this->dao->orderby('uv.i_items DESC');
  }

  // this is below code
  if($order == 'RATING') {

 $this->dao->join($this->getTable_Rating() . ' as uv', '(b.fk_i_user_id = uv.pk_i_id)', 'INNER');
    $this->dao->select('b.fk_i_user_id, s_user_email, avg((i_cat0 + i_cat1 + i_cat2 + i_cat3 + i_cat4 + i_cat5) / ( 6 - (case i_cat0 when 0 then 1 else 0 end) - (case i_cat1 when 0 then 1 else 0 end) - (case i_cat2 when 0 then 1 else 0 end) - (case i_cat3 when 0 then 1 else 0 end) - (case i_cat4 when 0 then 1 else 0 end) - (case i_cat5 when 0 then 1 else 0 end))) as d_average');
 
    $this->dao->orderby('ut.d_average ASC');
}

but i am not getting sellers list
« Last Edit: July 30, 2023, 09:49:01 AM by Bhagwati Suthar »