<?php  

$array = "select * from `product` where  (`p_title` like '%".$this->input->get('data')."%' or `p_description`='%".$this->input->get('data')."%') and `status`='1' order by `prd_id` desc "; 



$sub_cat = $this->db->query($array)->result_array();

$total_product=sizeof($sub_cat);

//$prd_cate = $this->db->select('*')->like("p_title",'')->or_where("p_description LIKE '%$this->input->get('data')%'")->get('category')->result_array();

?>



    <div class="offcanvas-overlay"></div>



    <!-- Page Title/Header Start -->

    <div class="page-title-section section" data-bg-image="assets/images/bg/page-title-1.webp">

        <div class="container">

            <div class="row">

                <div class="col">



                    <div class="page-title">

                        <h1 class="title">Shop</h1>

                        <ul class="breadcrumb">

                            <li class="breadcrumb-item"><a href="<?php echo base_url(); ?>">Home</a></li>

                            <li class="breadcrumb-item active">Products</li>

                        </ul>

                    </div>



                </div>

            </div>

        </div>

    </div>

    <!-- Page Title/Header End -->



    <!-- Shop Products Section Start -->

    <div class="section section-padding pt-0">



        <!-- Shop Toolbar Start -->

        <div class="shop-toolbar border-bottom">

            <div class="container">

                <div class="row learts-mb-n20">

                    <div class="col-md col-12 align-self-center learts-mb-20">

                        <div class="isotope-filter shop-product-filter" data-target="#shop-products">

                            <button class="active" data-filter="*">Search Results <?php if ($total_product>0) { ?>(1 - <?php echo $total_product; ?> product(s) <?php } else { ?>(0 Product <?php } ?> </button>

                        </div>

                    </div>



                    <div class="col-md-auto col-12 learts-mb-20">

                        <ul class="shop-toolbar-controls">



                            <li>

                                <div class="product-sorting">

                                    <select class="nice-select">

                                        <option value="menu_order" selected="selected">Sort by</option>

                                        <option value="popularity">Sort by popularity</option>

                                        <option value="date">Sort by latest</option>

                                        <option value="price">Sort by price: low to high</option>

                                        <option value="price-desc">Sort by price: high to low</option>

                                    </select>

                                </div>

                            </li>



                        </ul>

                    </div>



                </div>

            </div>

        </div>

        <!-- Shop Toolbar End -->



        <div class="section learts-mt-70">

            <div class="container">

                <div class="row learts-mb-n50">







                    <?php if(empty($sub_cat)){ ?>

            <div class="col-lg-12 col-12 learts-mb-50 order-lg-2">



                <img src="<?php echo base_url();?>assets/images/no-product-found.jpg" class="img-responsive">



            </div>

            <?php } else { ?>

                    <div class="col-lg-12 col-12 learts-mb-50 order-lg-2">

                        <!-- Products Start -->

                        <div id="shop-products" class="products isotope-grid row row-cols-xl-4 row-cols-md-3 row-cols-sm-2 row-cols-1">



                            <div class="grid-sizer col-1"></div>





                            <?php  

                        foreach($sub_cat as $get_prd){

                            if($get_prd['discount_type']==''){

                                $discount='';

                            } else{

                                if($get_prd['discount_type']=='Price'){

                                    $discount='₹'.$get_prd['discount'].' Off';

                                }else{

                                    $discount=$get_prd['discount'].'% Off';

                                }

                            }

                        ?>



                            <div class="grid-item col">

                                <div class="product">

                                    <div class="product-thumb">

                                        <a href="<?php echo base_url().'Product/product_details/'.md5($get_prd['prd_id']).'/?mode='.md5($get_prd['prd_id']); ?>" class="image">

                                            <img src="<?php echo base_url(); ?>uploads/product/thumbnail/<?php echo $get_prd['primary_image'];?>" alt="<?php echo $get_prd['p_title'];?>">

                                        </a>

                                        <a href="javascript:void(0)" data-productid="<?php echo $get_prd['prd_id'];?>" data-productname="<?php echo $get_prd['p_title'];?>" data-productprice="<?php echo $get_prd['p_sell_price'];?>" class="add-to-wishlist hintT-left <?php if($this->session->userdata('customer')){ ?>  add_wishlist <?php } else { ?> loginfirst <?php } ?> " data-hint="Add to wishlist"><i class="far fa-heart"></i></a>
                                         <span class="DisCnt"><?php echo $discount;?></span>
                                    </div>

                                    <div class="product-info">

                                        <h6 class="title"><a href="<?php echo base_url().'Product/product_details/'.md5($get_prd['prd_id']).'/?mode='.md5($get_prd['prd_id']); ?>"><?php echo $get_prd['p_title'];?></a></h6>

                                        <span class="price">
                                            <span class="old">₹<?php echo $get_prd['p_mrp'];?></span>
                                            <span class="new">₹<?php echo $get_prd['p_sell_price'];?></span>

                                           

                                        </span>

                                    </div>

                                </div>

                            </div>

                        <?php } ?>











                            

                        </div>

                        <!-- Products End -->

                    </div>





                <?php } ?>

                    



                </div>

            </div>

        </div>



    </div>

    <!-- Shop Products Section End -->



