This query search for products, there are products that has the same name but not the same size or whatever.
How can I add Select Distinct on this code?
private function query_products($category = 1, $id = NULL, $search = NULL){
$this->db->select('PP.*');
$query= $this->db->from("PLUGIN_PRODUCTS PP");
//->where('PCP.COUNTRY', $country);
if($search == NULL):
$query = $query->where('PP.PRODUCT_CATEGORY', $category);
else:
$query = $query->like('PP.PRODUCT_NAME', $search)
->or_like('PP.PRODUCT_DESCRIPTION', $search)
->or_like('PP.PRODUCT_CODE', $search)
->group_by("PP.ID");
endif;
if(!empty($id)):
$query = $query->where('PP.ID', $id);
endif;
return $query;
}