public function contact_details(){ $this->load->library('form_validation'); $this->form_validation->set_rules('name','Name','trim|required'); $this->form_validation->set_rules('email','Email','trim|required|valid_email'); $this->form_validation->set_rules('phone','Phone Number','trim|required|min_length[10]|max_length[10]'); $this->form_validation->set_rules('subject','Subject','trim|required'); $this->form_validation->set_rules('message','Message','trim|required'); $this->form_validation->set_error_delimiters("

","

"); if($this->form_validation->run()){ // $post=$this->input->post(); $captcha_response= trim($this->input->post('g-recaptcha-response')); if($captcha_response!=''){ $key_secret=''; $check=array( 'secret'=>$key_secret, 'response'=>$this->input->post('g-recaptcha-response') ); $start_process=curl_init(); curl_setopt($start_process, CURLOPT_URL,"https://www.google.com/recaptcha/api/siteverify"); curl_setopt($start_process, CURLOPT_POST, true); curl_setopt($start_process, CURLOPT_POSTFIELDS, http_build_query($check)); curl_setopt($start_process, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($start_process, CURLOPT_RETURNTRANSFER, true); $receive_data= curl_exec($start_process); $final_response= json_decode($receive_data,true); if($final_response['success']){ // unset($post['submit']); $store_data=array( 'name'=>$this->input->post('name'), 'email'=>$this->input->post('email'), 'phone'=>$this->input->post('phone'), 'subject'=>$this->input->post('subject'), 'message'=>$this->input->post('message'), ); $this->load->model('Visitor_Contact_Model','visitor'); $data=$this->visitor->insert($store_data); if($data){ $this->session->set_flashdata('success','We have Received Your Mail..Thanks for Contacting'); $message=$this->input->post('message'); $phone=$this->input->post('phone'); $subjectmail=$this->input->post('subject'); $name=$this->input->post('name'); $to=$this->input->post('email'); // User email pass here $subject = 'Welcome To Uthhan-Ecommerce'; $from = 'support@gergstore.com';// Pass here your mail id $this->load->library('email'); $config['protocol'] = 'sendmail'; $config['mailpath'] = '/usr/sbin/sendmail'; $config['charset'] = 'iso-8859-1'; $config['wordwrap'] = TRUE; $config['mailtype'] = 'html'; $this->email->initialize($config); // $body= $this->load->view('email/content.php'); $this->email->from('support@gergstore.com', 'UthhanStore'); $this->email->to($to); $this->email->cc(''); $this->email->bcc(''); $this->email->subject($subject); $this->email->message(' '.' '.'Thank You For Contacting Us. We will get back to you soon !!'.''."

Uthhan.org

"); $this->email->send(); $this->email->initialize($config); // $body= $this->load->view('email/content.php'); $this->email->from('support@gergstore.com', 'UthhanStore'); $this->email->to('support@gergstore.com', 'UthhanStore'); // $this->email->cc('support@gergstore.com'); // $this->email->bcc('testergerg2011@gmail.com'); $this->email->subject('Contact Us Details'); $this->email->message(''.''.'Name:'.$name.'
Email:'.$to.'
Phone Number:'.$phone.'
Message:'.$message.'
Subject:'.$subjectmail.''."

Uthhan.org

"); $this->email->send(); return redirect('Home/contactUs'); } else{ $this->session->set_flashdata('success','Data insertion failed'); return redirect('Home/contactUs'); } } else{ $this->session->set_flashdata('captcha_fail','Invalid Captcha , Please try Again!'); return redirect('Home/contactUs'); } } else{ $this->session->set_flashdata('captcha_fail','Invalid Captcha , Please try Again!'); return redirect('Home/contactUs'); } } else{ $fetch_mainCat=$this->home->fetch_mainCat(); $fetch_main_cat=$this->home->fetch_main_cat();//full $fetch_main_cat_ven = $this->home->fetch_main_cat_ven(); $this->load->view('contactUs',['fetch_main_cat_ven' => $fetch_main_cat_ven, 'fetch_mainCat'=>$fetch_mainCat,'fetch_main_cat'=>$fetch_main_cat]); } } public function register_check() { $this->load->library('form_validation'); $this->form_validation->set_rules('username', 'User Name', 'trim|required|regex_match[/^([a-z ])+$/i]'); $this->form_validation->set_message('regex_match', 'The %s Field must contain alphabetical characters'); $this->form_validation->set_rules('useremail', 'User Email', 'trim|required|valid_email'); $this->form_validation->set_rules('usernumber', 'Number', 'trim|required|min_length[10]|max_length[10]|is_unique[user_reg.user_number]'); $this->form_validation->set_message('is_unique', 'The %s is already Registered!,Try Another Phone Number'); $this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[4]|max_length[10]'); $this->form_validation->set_error_delimiters("

", "

"); if ($this->form_validation->run()) { // $post=$this->input->post(); // echo "
";
            //     print_r($post);
            //     die;
            $captcha_response = trim($this->input->post('g-recaptcha-response'));
            if ($captcha_response != '') {
                $key_secret = '6LdxPDcaAAAAAPo8YWoiIGzrbd7JJX6rZEXtqYri';
                $check = array(
                    'secret' => $key_secret,
                    'response' => $this->input->post('g-recaptcha-response'),
                );
                $start_process = curl_init();
                curl_setopt($start_process, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify");
                curl_setopt($start_process, CURLOPT_POST, true);
                curl_setopt($start_process, CURLOPT_POSTFIELDS, http_build_query($check));
                curl_setopt($start_process, CURLOPT_SSL_VERIFYPEER, false);
                curl_setopt($start_process, CURLOPT_RETURNTRANSFER, true);
                $receive_data = curl_exec($start_process);
                $final_response = json_decode($receive_data, true);
                if ($final_response['success']) {
                    $store_data = array(
                        'user_username' => $this->input->post('username'),
                        'user_email' => $this->input->post('useremail'),
                        'user_number' => $this->input->post('usernumber'),
                        'user_password' => $this->input->post('password'),
                        'user_gender' => $this->input->post('Gender')
                    );
                    // echo "
";
                    // print_r($store_data);die;
                    // unset($post['submit']);
                    $this->load->model('Authenticate_Model', 'auth');
                    $data = $this->auth->insert($store_data);
                    if ($data) {
                        $this->load->model('Product_Model', 'product');
                        $cust_name = $store_data['user_username'];
                        $fetch_noti_count = 0;
                        $fetch_noti_count = $this->product->fetch_noti_count();
                        if ($fetch_noti_count == 0) {
                            $data_array = array(
                                'noti_name' => 'Customer ' . $cust_name . ' has recently registered in Uthhanecom',
                                'noti_status' => 'Register',
                                'noti_type' => 'Customer',
                                'noti_created_at' => date('Y-m-d H:i:s'),
                                'noti_flag_start' => $fetch_noti_count + 1,
                                'noti_flag_end' => $fetch_noti_count,
                            );
                            $insert_noti_data = $this->product->insert_noti_data($data_array);
                        } else {
                            $fetch_last_noti = $this->product->fetch_last_noti();
                            $data_array = array(
                                'noti_name' => 'Customer ' . $cust_name . ' has recently registered in Uthhanecom',
                                'noti_status' => 'Register',
                                'noti_type' => 'Customer',
                                'noti_created_at' => date('Y-m-d H:i:s'),
                                'noti_flag_start' => $fetch_noti_count + 1,
                                'noti_flag_end' => $fetch_last_noti->noti_flag_end,
                            );
                            $insert_noti_data = $this->product->insert_noti_data($data_array);
                        }
                        //sending order details to mail
                        $this->load->library('email');
                        $config['protocol'] = 'sendmail';
                        $config['mailpath'] = '/usr/sbin/sendmail';
                        $config['charset'] = 'iso-8859-1';
                        $config['wordwrap'] = true;
                        $config['mailtype'] = 'html';
                        $this->email->initialize($config);
                        //$body= $this->load->view('email/content.php');
                        $this->email->from('uthhanops123@gmail.com', 'UthhanStore');
                        $this->email->to($store_data['user_email']);
                        $this->email->cc('uthhanops123@gmail.com');
                        $this->email->bcc('');
                        $this->email->subject('Welcome to Uthhan Store, You are registered successfully ');
                        $this->email->message('
Hello ' . $store_data['user_username'] . ',

Thanks for registering to Uthhan Store.

Uthhan is an only marketplace for Indian Handicrafts available at a very cheaper cost compared to other vendors & sellers. With more than 12,000 registered artisans across India, Having more than 50,000+ counting in 15+ categories.

Click here to visit Uthhan Store!

Thanks and Regards,
Uthhan Ecommerce Store
No. 820, RNS Reddy Complex, 13th Cross, West of S Kariyappa Road, Jayanagar 7th Block, Bangalore- 560082
UthhanStore|Uthhan

Uthhan Store: Products sold by an Artisans are subject to that few terms and conditions of sale. See Terms & Services for details.

If you would rather not to receive future e-mails from us, please opt-out by sending an email to support@gergstore.com'); $this->email->send(); // $this->session->set_flashdata('success', 'You are succesfully registered as an Uthhan Ecommerce Customer'); // return redirect('Authenticate/register'); $this->session->set_flashdata('success', 'You have Succesfully Registered'); return redirect('Authenticate/login'); } else { $this->session->set_flashdata('success', 'Failed to register, Please try Again!'); return redirect('Authenticate/register'); } } else { $this->session->set_flashdata('captcha_fail', 'Invalid Captcha , Please try Again!'); return redirect('Authenticate/register'); } } else { $this->session->set_flashdata('captcha_fail', 'Invalid Captcha , Please try Again!'); return redirect('Authenticate/register'); } } else { $fetch_mainCat = MainCatList::all(); $fetch_main_cat = MainCatList::fetch_main_cat(); $fetch_register_seo=EcomSeoMetaTag::fetch_register_seo(); //------------------------------------ return view('register', compact('fetch_mainCat', 'fetch_main_cat', 'fetch_register_seo')); } public function cart() { $fetch_mainCat = MainCatList::all(); $Bazzar1 = request()->query('Baazar'); if ($Bazzar1) { $Baazar = 'Baazar'; } else { $Baazar = null; } $category1 = request()->query('category'); // dd($category1); if ($category1) { $category = 'Express'; } else { $category = null; } // dd($category); $fetch_main_cat = MainCatList::fetch_main_cat(); $fetch_main_cat_ven = VenMainCatList::fetch_main_cat_ven(); $cart_data = $this->cart->contents(); foreach ($cart_data as $cart) { $prd_id = $cart['id']; } if ($cart_data) { $id = $prd_id; $fetch_exp_cat_qty = $this->home->fetch_exp_cat_qty($id); } else { $fetch_exp_cat_qty = null; } // echo "
";
        // print_r($fetch_main_cat);die;
        $this->load->view('cart', ['fetch_exp_cat_qty' => $fetch_exp_cat_qty, 'category' => $category, 'Baazar' => $Baazar, 'fetch_main_cat_ven' => $fetch_main_cat_ven, 'fetch_mainCat' => $fetch_mainCat, 'fetch_main_cat' => $fetch_main_cat, 'cart_data' => $cart_data]);
    }
    }

    public function fetch_festival_products1($main_cat, $sub_cat, $sub_sub_cat, $start_price, $end_price, $sorting, $rating, $discount, $limit, $offset, $keyword)
    {
        $keyword_array = explode(',', $keyword);
        if ($main_cat == null && $sub_cat == null && $sub_sub_cat == null) {
            if ($start_price == null && $end_price == null && $rating == null && $discount == null && $keyword == null) {
                if ($sorting == "date") {
                    $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                        ->from('uthhan_product uth')
                        ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                    ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                    ->where('covid_status', 'Covid Flea Artisan')
                        ->where('uthreseller_uthhan!=', 'Reseller')
                        ->where('status', 'Approved')
                        ->order_by('id', 'DESC')
                        ->limit($limit, $offset)
                        ->get();
                    if ($query->num_rows() > 0) {
                        return $query->result();
                    } else {
                        return false;
                    }
                } else if ($sorting == "price-low") {
                    $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                        ->from('uthhan_product uth')
                        ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                        ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                        ->where('covid_status', 'Covid Flea Artisan')
                        ->where('uth.reseller_uthhan!=', 'Reseller')
                        ->where('uth.status', 'Approved')
                        ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'ASC')
                        ->limit($limit, $offset)
                        ->get();
                    if ($query->num_rows() > 0) {
                        return $query->result();
                    } else {
                        return false;
                    }
                } else if ($sorting == "price-high") {
                    $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                        ->from('uthhan_product uth')
                        ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                    ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                    ->where('covid_status', 'Covid Flea Artisan')
                        ->where('uth.reseller_uthhan!=', 'Reseller')
                        ->where('uth.status', 'Approved')
                        ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'DESC')
                        ->limit($limit, $offset)
                        ->get();
                    if ($query->num_rows() > 0) {
                        return $query->result();
                    } else {
                        return false;
                    }
                } else {
                    $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                        ->from('uthhan_product uth')
                        ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                        ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                        ->where('covid_status', 'Covid Flea Artisan')
                        ->where('uth.reseller_uthhan!=', 'Reseller')
                        ->where('uth.status', 'Approved')
                        ->order_by('id', 'DESC')
                        ->limit($limit, $offset)
                        ->get();
                    if ($query->num_rows() > 0) {
                        return $query->result();
                    } else {
                        return false;
                    }
                }
            } else if ($start_price != null && $end_price != null && $rating == null && $discount == null && $keyword == null) {
                if ($sorting == "date") {
                    $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                        ->from('uthhan_product uth')
                        ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                        ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                        ->where('covid_status', 'Covid Flea Artisan')
                        ->where('uth.reseller_uthhan!=', 'Reseller')
                        ->where('uth.status', 'Approved')
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                        ->limit($limit, $offset)
                        ->order_by('id', 'DESC')
                        ->get();
                    if ($query->num_rows() > 0) {
                        return $query->result();
                    } else {
                        return false;
                    }
                } else if ($sorting == "price-low") {
                    $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                        ->from('uthhan_product uth')
                        ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                        ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                        ->where('covid_status', 'Covid Flea Artisan')
                        ->where('uth.reseller_uthhan!=', 'Reseller')
                        ->where('uth.status', 'Approved')
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                        ->limit($limit, $offset)
                        ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'ASC')
                        ->get();
                    if ($query->num_rows() > 0) {
                        return $query->result();
                    } else {
                        return false;
                    }
                } else if ($sorting == "price-high") {
                    $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                        ->from('uthhan_product uth')
                        ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                        ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                        ->where('covid_status', 'Covid Flea Artisan')
                        ->where('uth.reseller_uthhan!=', 'Reseller')
                        ->where('uth.status', 'Approved')
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                        ->limit($limit, $offset)
                        ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'DESC')
                        ->get();
                    if ($query->num_rows() > 0) {
                        return $query->result();
                    } else {
                        return false;
                    }
                } else {
                    $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                        ->from('uthhan_product uth')
                        ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                        ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                        ->where('covid_status', 'Covid Flea Artisan')
                        ->where('uth.reseller_uthhan!=', 'Reseller')
                        ->where('uth.status', 'Approved')
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                        ->limit($limit, $offset)
                        ->order_by('id', 'DESC')
                        ->get();
                    if ($query->num_rows() > 0) {
                        return $query->result();
                    } else {
                        return false;
                    }
                }
            } else if ($start_price != null && $end_price != null && $rating == null && $discount == null  && $keyword != null) {
                if ($sorting == "date") {
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                        $this->db->from('uthhan_product uth');
                        $this->db->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                        $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                        $this->db->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('uth.reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->order_by('id', 'DESC');
                        $this->db->limit($limit, $offset);
                        $query = $this->db->get();
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                } else if ($sorting == "price-low") {
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                        $this->db->from('uthhan_product uth');
                        $this->db->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                    $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                    $this->db->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('uth.reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->limit($limit, $offset);
                        $this->db->order_by('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100)', 'ASC');
                
                        $query = $this->db->get();
                        
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                } else if ($sorting == "price-high") {
                    
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                        $this->db->from('uthhan_product uth');
                        $this->db->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                        $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                        $this->db ->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('uth.reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->limit($limit, $offset);
                        $this->db->order_by('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100)', 'DESC');
                
                        $query = $this->db->get();
                        
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                } else {
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                        $this->db->from('uthhan_product uth');
                        $this->db->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                        $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                        $this->db->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('uth.reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->order_by('id', 'DESC');
                        $this->db->limit($limit, $offset);
                        $query = $this->db->get();
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                }
            } else {
                if ($sorting == "date") {
                    $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                        ->from('uthhan_product uth')
                        ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                        ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                        ->where('covid_status', 'Covid Flea Artisan')
                        ->where('uth.reseller_uthhan!=', 'Reseller')
                        ->where('uth.status', 'Approved')
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                        ->order_by('id', 'DESC')
                        ->limit($limit, $offset)
                        ->get();
                    if ($query->num_rows() > 0) {
                        return $query->result();
                    } else {
                        return false;
                    }
                } else if ($sorting == "price-low") {
                    $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                        ->from('uthhan_product uth')
                        ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                        ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                        ->where('covid_status', 'Covid Flea Artisan')
                        ->where('uth.reseller_uthhan!=', 'Reseller')
                        ->where('uth.status', 'Approved')
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                        ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'ASC')
                        ->limit($limit, $offset)
                        ->get();
                    if ($query->num_rows() > 0) {
                        return $query->result();
                    } else {
                        return false;
                    }
                } else if ($sorting == "price-high") {
                    $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                        ->from('uthhan_product uth')
                        ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                        ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                        ->where('covid_status', 'Covid Flea Artisan')
                        ->where('uth.reseller_uthhan!=', 'Reseller')
                        ->where('uth.status', 'Approved')
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                        ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'DESC')
                        ->limit($limit, $offset)
                        ->get();
                    if ($query->num_rows() > 0) {
                        return $query->result();
                    } else {
                        return false;
                    }
                } else {
                    $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                        ->from('uthhan_product uth')
                        ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                        ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                        ->where('covid_status', 'Covid Flea Artisan')
                        ->where('uth.reseller_uthhan!=', 'Reseller')
                        ->where('uth.status', 'Approved')
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                        ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                        ->order_by('id', 'DESC')
                        ->limit($limit, $offset)
                        ->get();
                    if ($query->num_rows() > 0) {
                        return $query->result();
                    } else {
                        return false;
                    }
                }
            }
        } else {
            if ($main_cat != null &&  $sub_cat == null &&  $sub_sub_cat == null) {
                if ($start_price == null && $end_price == null && $rating == null && $discount == null  && $keyword == null) {
                    if ($sorting == "date") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.status', 'Approved')
                            ->order_by('id', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-low") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.status', 'Approved')
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'ASC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-high") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.status', 'Approved')
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.status', 'Approved')
                            ->order_by('id', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    }
                } else if ($start_price != null && $end_price != null && $rating == null && $discount == null  && $keyword == null) {
                    if ($sorting == "date") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->limit($limit, $offset)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('id', 'DESC')
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-low") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->limit($limit, $offset)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'ASC')
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-high") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->limit($limit, $offset)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'DESC')
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->limit($limit, $offset)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('id', 'DESC')
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    }
            } else if ($start_price != null && $end_price != null && $rating == null && $discount == null  && $keyword != null) {
                if ($sorting == "date") {
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                        $this->db->from('uthhan_product uth');
                        $this->db->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                        $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                        $this->db->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('uth.reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->order_by('id', 'DESC');
                        $this->db->limit($limit, $offset);
                        $query = $this->db->get();
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                } else if ($sorting == "price-low") {
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                        $this->db->from('uthhan_product uth');
                        $this->db->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                        $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                        $this->db->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('uth.reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->limit($limit, $offset);
                        $this->db->order_by('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100)', 'ASC');
                
                        $query = $this->db->get();
                        
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                } else if ($sorting == "price-high") {
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                        $this->db->from('uthhan_product uth');
                        $this->db->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                        $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                        $this->db->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->limit($limit, $offset);
                        $this->db->order_by('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100)', 'DESC');
                
                        $query = $this->db->get();
                        
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                } else {
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                        $this->db->from('uthhan_product uth');
                        $this->db->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                        $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                        $this->db->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->order_by('id', 'DESC');
                        $this->db->limit($limit, $offset);
                        $query = $this->db->get();
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                }
                } else {
                    if ($sorting == "date") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('id', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-low") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'ASC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-high") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('id', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    }
                }
            } else if ($main_cat != null && $sub_cat != null && $sub_sub_cat == null) {
                if ($start_price == null && $end_price == null && $rating == null && $discount == null  && $keyword == null) {
                    if ($sorting == "date") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.status', 'Approved')
                            ->order_by('id', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-low") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.status', 'Approved')
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'ASC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-high") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.status', 'Approved')
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.status', 'Approved')
                            ->order_by('id', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    }
                } else if ($start_price != null && $end_price != null && $rating == null && $discount == null  && $keyword == null) {
                    if ($sorting == "date") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->where('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->limit($limit, $offset)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('id', 'DESC')
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-low") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->limit($limit, $offset)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'ASC')
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-high") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->limit($limit, $offset)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'DESC')
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->limit($limit, $offset)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('id', 'DESC')
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    }
            } else if ($start_price != null && $end_price != null && $rating == null && $discount == null  && $keyword != null) {
                if ($sorting == "date") {
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                        $this->db->from('uthhan_product uth');
                        $this->db->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                        $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                        $this->db->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('uth.reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->order_by('id', 'DESC');
                        $this->db->limit($limit, $offset);
                        $query = $this->db->get();
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                } else if ($sorting == "price-low") {
                    
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                        $this->db->from('uthhan_product uth');
                        $this->db->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                        $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                        $this->db->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('uth.reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->limit($limit, $offset);
                        $this->db->order_by('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100)', 'ASC');
                
                        $query = $this->db->get();
                        
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                } else if ($sorting == "price-high") {
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                        $this->db->from('uthhan_product uth');
                        $this->db->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                        $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                        $this->db->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('uth.reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->limit($limit, $offset);
                        $this->db->order_by('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100)', 'DESC');
                
                        $query = $this->db->get();
                        
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                } else {
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                        $this->db->from('uthhan_product uth');
                        $this->db->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                        $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                        $this->db->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('uth.reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->order_by('id', 'DESC');
                        $this->db->limit($limit, $offset);
                        $query = $this->db->get();
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                }
                } else {
                    if ($sorting == "date") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('id', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-low") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'ASC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-high") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                             ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('id', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    }
                }
            } else if ($main_cat != null && $sub_cat != null && $sub_sub_cat != null) {
                if ($start_price == null && $end_price == null && $rating == null && $discount == null   && $keyword == null) {
                    if ($sorting == "date") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.sub_sub_category', $sub_sub_cat)
                            ->where('uth.status', 'Approved')
                            ->order_by('id', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-low") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                             ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.sub_sub_category', $sub_sub_cat)
                            ->where('uth.status', 'Approved')
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'ASC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-high") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.sub_sub_category', $sub_sub_cat)
                            ->where('uth.status', 'Approved')
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.sub_sub_category', $sub_sub_cat)
                            ->where('uth.status', 'Approved')
                            ->order_by('id', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    }
                } else if ($start_price != null && $end_price != null && $rating == null && $discount == null && $keyword == null) {
                    if ($sorting == "date") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                             ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.sub_sub_category', $sub_sub_cat)
                            ->where('uth.status', 'Approved')
                            ->limit($limit, $offset)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('id', 'DESC')
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-low") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.sub_sub_category', $sub_sub_cat)
                            ->where('uth.status', 'Approved')
                            ->limit($limit, $offset)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'ASC')
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-high") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                             ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.sub_sub_category', $sub_sub_cat)
                            ->where('status', 'Approved')
                            ->limit($limit, $offset)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'DESC')
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                            ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.sub_sub_category', $sub_sub_cat)
                            ->where('uth.status', 'Approved')
                            ->limit($limit, $offset)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('id', 'DESC')
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    }
            } else if ($start_price != null && $end_price != null && $rating == null && $discount == null  && $keyword != null) {
                if ($sorting == "date") {
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                        $this->db->from('uthhan_product uth');
                        $this->db->where('uth.reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                           $this->db ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                            $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                            $this->db->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->order_by('id', 'DESC');
                        $this->db->limit($limit, $offset);
                        $query = $this->db->get();
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                } else if ($sorting == "price-low") {
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                        $this->db->from('uthhan_product uth');
                         $this->db->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                            $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                            $this->db->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('uth.reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->limit($limit, $offset);
                        $this->db->order_by('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100)', 'ASC');
                
                        $query = $this->db->get();
                        
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                } else if ($sorting == "price-high") {
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                        $this->db->from('uthhan_product uth');
                         $this->db->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                            $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                            $this->db->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('uth.reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->limit($limit, $offset);
                        $this->db->order_by('(uth.selling_price * (110 / 100)) * ((gst + 100) / 100)', 'DESC');
                
                        $query = $this->db->get();
                        
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                } else {
                    $results = array(); // Array to store results
                    foreach ($keyword_array as $keyword) {
                        $this->db->select('id, product_name, mrp, uthhan_charge, product_category, sub_category, sub_sub_category, selling_price, gst, image_url_1, product_rating_average');
                         $this->db->from('uthhan_product uth');
                         $this->db->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id');
                            $this->db->join('artisan_signup art', 'art.art_id=mid.reg_id');
                            $this->db->where('covid_status', 'Covid Flea Artisan');
                        $this->db->where('uth.reseller_uthhan !=', 'Reseller');
                        $this->db->where('uth.status', 'Approved');
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) >=', $start_price);
                        $this->db->where('(uth.selling_price * (110 / 100)) * ((uth.gst + 100) / 100) <=', $end_price);
                        $this->db->group_start();
                        $this->db->like('uth.product_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_category', $keyword, 'both');
                        $this->db->or_like('uth.sub_sub_category', $keyword, 'both');
                        $this->db->or_like('uth.product_name', $keyword, 'both');
                        $this->db->group_end();
                        $this->db->limit($limit, $offset);
                        // $this->db->order_by('(selling_price * (110 / 100)) * ((gst + 100) / 100)', 'ASC');
                        $this->db->order_by('id', 'DESC');
                
                        $query = $this->db->get();
                        
                        // Add results to the $results array
                        $results[] = $query->result();
                    }
                    
                    // Check if any results were found
                    $total_results = count($results);
                    if ($total_results > 0) {
                        // If results were found, return the combined array
                        return array_merge(...$results);
                    } else {
                        // If no results were found, return false
                        return false;
                    }
                }
                } else {
                    if ($sorting == "date") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                             ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.sub_sub_category', $sub_sub_cat)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('id', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-low") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                             ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.sub_sub_category', $sub_sub_cat)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'ASC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else if ($sorting == "price-high") {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                             ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.sub_sub_category', $sub_sub_cat)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('(uth.selling_price*(110/100))*((uth.gst+100)/100)', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    } else {
                        $query = $this->db->select('id,product_name,mrp,uthhan_charge,product_category,sub_category,sub_sub_category,selling_price,gst,image_url_1,product_rating_average')
                             ->from('uthhan_product uth')
                            ->join('merchant_ids mid', 'uth.uthhan_id=mid.merchant_id')
                            ->join('artisan_signup art', 'art.art_id=mid.reg_id')
                            ->where('covid_status', 'Covid Flea Artisan')
                            ->where('uth.reseller_uthhan!=', 'Reseller')
                            ->like('uth.product_category', $main_cat)
                            ->where('uth.sub_category', $sub_cat)
                            ->where('uth.sub_sub_category', $sub_sub_cat)
                            ->where('uth.status', 'Approved')
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) >=', $start_price)
                            ->where('(uth.selling_price*(110/100))*((uth.gst+100)/100) <=', $end_price)
                            ->order_by('id', 'DESC')
                            ->limit($limit, $offset)
                            ->get();
                        if ($query->num_rows() > 0) {
                            return $query->result();
                        } else {
                            return false;
                        }
                    }
                }
            }
        }
    }