Codeigniter select query is not working - php

I am trying to fetch data from database using CI. But my code is not working.
Showing error :
A PHP Error was encountered Severity: Notice
Message: Undefined variable: h
Filename: confrence/load_Confrence_passes.php
Here is my controller code:
public function load_Confrence_passes()
{
//load the model
$this->load->model('confrence_model');
//load the method of model
$data['h']=$this->confrence_model->confrencepasses();
$this->load->view('mheader');
$this->load->view('confrence/load_Confrence_passes');
$this->load->view('mfooter');
}
And here is my Model code:
public function confrencepasses()
{
$this->db->select('*');
$this->db->where('confrence_cat','Confrence passes');
$query = $this->db->get('confrence');
return $query;
}
And here is my view code:
<div class="row">
<?php
foreach($h->result() as $row)
{
?>
<div class="col-sm-12 semminar-pass reg">
<div class="col-sm-8 border">
<span class="col-sm-12 training-title"><?php echo $row->confrence_title ?></span>
<span class="col-sm-12 training-extra-info"><?php echo $row->confrence_description ?></span>
<div class="training-bar col-sm-9"></div>
<div style="clear:both;"></div>
<span class="col-sm-12 training-price">
<strong><?php echo $row->confrence_price ?> $</strong>, Taxes included</span>
</div>
<div class="col-sm-4 last-block">
<div class="col-sm-6 btn-oa" data-relation="5">
<span class="border-left border"></span>
<span class="border-right border"></span>
<i class="jbt-icon icon-oa"></i>
Learning Objectives
</div>
<div class="col-sm-6">
<a id="btn-atsc-5" class="btn-add-to-shopping-cart " href="javascript:void(0)"
onclick="addTrainingToShoppingCart(5);">
<i class="glyphicon glyphicon-shopping-cart"></i>
<span class="text">Add to cart</span>
</a>
</div>
</div>
<?php
}
?>
This is the first time I am working on CI.

you need to pass $data array to views then you can hold the array in views.
Here is my controller code:
public function load_Confrence_passes()
{
//load the model
$this->load->model('confrence_model');
//load the method of model
$data['h']=$this->confrence_model->confrencepasses()->result();
$this->load->view('mheader');
$this->load->view('confrence/load_Confrence_passes',$data);
$this->load->view('mfooter');
}
In Views
<?php
foreach($h as $row)
{
echo $row->confrence_title;
}
?>

Data is passed from the controller to the view.
Parse data like $this->load->view('content', $data);
public function load_Confrence_passes()
{
//load the model
$this->load->model('confrence_model');
//load the method of model
$data['h']=$this->confrence_model->confrencepasses();
$this->load->view('content', $data);
$this->load->view('mheader');
$this->load->view('confrence/load_Confrence_passes');
$this->load->view('mfooter');
}

Changes in Controller
public function load_Confrence_passes()
{
//load the model
$this->load->model('confrence_model');
//load the method of model
$data['h']=$this->confrence_model->confrencepasses();
$this->load->view('mheader', $data);
$this->load->view('confrence/load_Confrence_passes');
$this->load->view('mfooter');
}
Changes in Model
public function confrencepasses()
{
$this->db->select('*');
$this->db->from('confrence');
$this->db->where('confrence_cat','Confrence passes');
$query = $this->db->get();
if ($query->num_rows() > 0) {
return $query->result_array();
} else {
return array();
}
}
Changes in View
<div class="row">
<?php
foreach($h as $row)
{
?>
<div class="col-sm-12 semminar-pass reg">
<div class="col-sm-8 border">
<span class="col-sm-12 training-title"><?php echo $row['confrence_title']; ?></span>
<span class="col-sm-12 training-extra-info"><?php echo $row['confrence_description']; ?></span>
<div class="training-bar col-sm-9"></div>
<div style="clear:both;"></div>
<span class="col-sm-12 training-price">
<strong><?php echo $row['confrence_price']; ?> $</strong>, Taxes included</span>
</div>
<div class="col-sm-4 last-block">
<div class="col-sm-6 btn-oa" data-relation="5">
<span class="border-left border"></span>
<span class="border-right border"></span>
<i class="jbt-icon icon-oa"></i>
Learning Objectives
</div>
<div class="col-sm-6">
<a id="btn-atsc-5" class="btn-add-to-shopping-cart " href="javascript:void(0)"
onclick="addTrainingToShoppingCart(5);">
<i class="glyphicon glyphicon-shopping-cart"></i>
<span class="text">Add to cart</span>
</a>
</div>
</div>
<?php
}
?>
This may help you..thanks!

Make this way and you'll have certain variable available in all views/partials:
public function load_Confrence_passes()
{
//load the model
$this->load->model('confrence_model');
//load the method of model
$data['h']=$this->confrence_model->confrencepasses();
$this->load->vars($data);// https://www.codeigniter.com/user_guide/libraries/loader.html#CI_Loader::vars
$this->load->view('mheader');
$this->load->view('confrence/load_Confrence_passes');
$this->load->view('mfooter');
}

Related

i want to fetch data from db get by name not by is id by clicking the hyper link

i am new in code igniter i am trying to fetch the data of all jobs of same location in my view
i write some code but when i try to get the data its gives me single data i want to fetch all data of same location
here is my controler
public function location($location){
$data['jobs'] = $this->edituser_model->getBlogBylocation($location);
$this->load->view('locwise' , ['data'=>$data]);
}
and model is
public function getBlogBylocation($location){
$this->db->select('*');
$this->db->like('location', $location);
$query = $this->db->get('jobs');
if($query->num_rows() > 0){
return $query->row();
}else {
return false;
}
}
and my view is
<?php foreach ($data as $key => $data): ?>
<div class="job-box">
<div class="company-logo">
</div>
<div class="row">
<div class="col-lg-12">
<div class="alert alert-success alert-2" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
Recently Posted Jobs in <?php echo $data->location?>
Citi</div>
<div class="row">
<div class="job-box">
<div class="description">
<div class="float-left">
<h5 class="title"><?php echo $data->job_title?></h5>
<div class="candidate-listing-footer">
<ul>
<li><i class="flaticon-pin"> </i><?php echo $data->location?></li>
<li><i class="flaticon-money"> </i><?php echo $data->salary?></li>
<li><i class="flaticon-work"> </i><?php echo $data->timing?></li>
<!--<li><i class="flaticon-honor"> </i><?php echo $jobs->qualification?></li>
<li><i class="flaticon-notepad"> </i><?php echo $jobs->experience?></li>-->
</ul>
<h6>Deadline:<?php echo $data->deadline?></h6>
</div>
</div>
<div class="div-right">
Apply Now
<!--<i class="flaticon-heart favourite"></i>-->
</div>
</div>
</div>
</div>
</div><!--end row-->
</div>
</div>
<?php endforeach ?>
</div>
i want to show multi record not single by clicking the hyper link
Many Thanks in advance
Junaid Amin
Please update your Controller method, Model method and View as follows:
Controller::Method:
public function location($location){
$data['jobs'] = $this->edituser_model->getBlogBylocation($location);
$this->load->view('locwise' , $data);
}
Model::Method:
public function getBlogBylocation($location){
$this->db->select('*');
$this->db->like('location', $location);
$query = $this->db->get('jobs');
if($query->num_rows() > 0){
return $query->result();
} else {
return false;
}
}
View:
<?php foreach ($jobs as $row): ?>
//Your staff goes here (i.e. $row->name_of_properties)
<?php endforeach ?>
pass name instead of id in you a tag and make route for that inside config/routes file
$route['location/(:any)'] = 'controller_name/function_name/$1';
public function location($location){
$data['jobs'] = $this->edituser_model->getBlogBylocation($location);
$this->load->view('locwise' , ['data'=>$data]);
}

GET will not be transmitted

I have a problem with this GET.
I want to pass on three values (ygo, dane, 1) with a link to index, so that these values are entered in the respective WHERE.
But unfortunately there is no value on the page and I just don't know why.
IMG:
https://screenshots.firefox.com/g6qcToRn.../127.0.0.1
Controller:
public function index($slug) {
$url = 'edition/index';
$array = explode ('/',$url);
$data['array'] = $array[0];
$data['title'] = 'Edition Liste';
$data['edition_listes'] = $this->Edition_model->edition_listess($slug);
$this->load->view('templates/header', $data);
$this->load->view($url, $data);
$this->load->view('templates/footer');
}
public function edition($tcg,$id,$short) {
$url = 'edition/edition';
$array = explode ('/',$url);
$data['array'] = $array[0];
$data['get_edition'] = $this->Edition_model->get_edition($tcg,$id,$short);
$this->load->view('templates/header', $data);
$this->load->view($url, $data);
$this->load->view('templates/footer');
}
Model:
public function edition_listess($slug) {
$this->db->select('*');
$this->db->from('db_edition');
$this->db->where('db_edition.tb_edition_tcg', $slug);
$this->db->order_by('db_edition.tb_edition_kurzel', 'ASC');
$this->db->order_by('db_edition.tb_edition_date', 'ASC');
$query = $this->db->get();
return $query->result_array();
}
public function get_edition($tcg,$id,$short) {
$this->db->select('*');
$this->db->from('db_edition');
$this->db->where('db_edition.tb_edition_tcg', $tcg);
$this->db->where('db_edition.tb_edition_id', $id);
$this->db->or_where('db_edition.tb_edition_kurzel', $short);
$this->db->order_by('db_edition.tb_edition_kurzel', 'ASC');
$this->db->order_by('db_edition.tb_edition_date', 'ASC');
$query = $this->db->get();
return $query->result_array();
}
index.php
<?php echo validation_errors(); ?>
<title><?php echo $title; ?></title>
<div class="row">
<div class="col-xs-6 col-lg-1">
</div>
<div class="col-xs-6 col-lg-10">
<?php foreach ($edition_listes as $edition_liste): ?>
<div class="list-group">
<a href="<?php echo base_url(); ?>edition/edition/<?php echo $edition_liste['tb_edition_tcg'];?>/<?php if($edition_liste['tb_edition_kurzel'] > '') { echo $edition_liste['tb_edition_kurzel']; } else { echo $edition_liste['tb_edition_id']; } ?>" class="list-group-item list-group-item-action list-group-item-secondary">
<div class="media">
<img class="media-object img-rounded img-responsive" src="<?php echo base_url(); ?>/assets/images/display.png" alt="placehold.it/350x250">
<div class="media-body">
<h4 class="list-group-item-heading"><?php echo $edition_liste['tb_edition_name'];?></h4>
<p class="list-group-item-text">
<b>SET ID: </b><?php if($edition_liste['tb_edition_kurzel']): echo $edition_liste['tb_edition_kurzel']; endif; ?></br>
<b>Kartenmenge: </b><?php echo $edition_liste['tb_edition_size'];?></br>
<b>Release: </b>00.00.0000
</p>
</div>
<div class="col-md-3 text-right">
<h5 class="colors">Pre-Release: <button class="btn btn-primary"><i class="fa fa-check-square"></i></button></h5>
<h5 class="colors">Pre-Release: <button class="btn btn-primary"><i class="fa fa-square"></i></button></h5>
</div>
</div>
</a>
</div>
<?php endforeach; ?>
</div>
<div class="col-xs-6 col-lg-1">
</div>
</div>
edition.php (test page)
<?php echo validation_errors(); ?>
<?php echo $slug; ?>
It looks like you are not passing the third argument to edition($tcg,$id,$short). That likely means your model is using null for the value of $short in the call to $this->db->or_where('db_edition.tb_edition_kurzel', $short); so it is probably not returning any records.
Your code could be a lot easier to read. Here is code-snippet suggestion on how to create the link to the edition controller
...
<div class="list-group">
<?php
$tcg = $edition_liste['tb_edition_tcg'];
if($edition_liste['tb_edition_kurzel'] !== '') // use a more reliable test for an empty string than > ''
{
$id = $edition_liste['tb_edition_kurzel'];
}
else
{
$id = $edition_liste['tb_edition_id'];
}
$short = 1;
?>
<a href="<?= base_url("edition/edition/$tcg/$id/$short"); ?>" class="list-group-item list-group-item-action list-group-item-secondary">
...
In case you are not familiar with the syntax <?= is exactly the same as <?php echo - but with a lot less typing.
Now, a bonus suggestion. I'm not sure exactly why you are using this code
$url = 'edition/index';
There is a way to get the current controller and method without hard-coding it.
$url = $this->router->class . '/' . $this->router->method;
That way if you rename the controller or the method you don't have to change the hard-coded string. Yeah!
CodeIgniter does not document the router class, but the source code is in /system/core/Router.php and every controller will have an instance of the router class available as the property $this->router.

how to pass Array of object to view ? MVC ..in Codeigniter

I'm not understand how to pass array of object which contain data of table and this is store in one variable when model query return..
so help me...
more time im spend on this error so if any one have idea on this error
Error :
Undefined variable: data Filename: employee/view_Admin_Profile.php
Line Number: 164
at line is <?php echo ($data->sub_dept_name);?>
contoller :
public function update_Admin_Profile($emp_id)
{
$data = $this->Loginm->getEmployeeProfile($emp_id);
$this->load->view('admin/header',$data);
$this->load->view('admin/sidebar',$data);
$this->load->view('employee/update_Admin_Profile',$data);
$this->load->view('admin/footer');
}
view:
<div class="col-md-12">
<div class="form-group">
<label class="col-lg-4 control-lable">Gendar:</label>
<div class="col-lg-8">
<?php echo ($data->gender);?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label class="col-lg-4 control-lable">Department Name:</label>
<div class="col-lg-8">
<?php echo ($data->sub_dept_name);?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label class="col-lg-4 control-lable">Role:</label>
<div class="col-lg-8">
<?php echo ($getEmpProfile->role_name);?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label class="col-lg-4 control-lable">Nationality:</label>
<div class="col-lg-8">
<?php echo ($data->nationality);?>
</div>
</div>
</div>
Model :
public function getEmployeeProfile($emp_id)
{
$this->db->select('*');
$this->db->from('employee e');
$this->db->join('sub_department sd','sd.sub_dept_id = e.sub_dept_id','left');
$this->db->join('department d','d.dept_id = sd.dept_id','left');
$this->db->join('user_role ur','ur.role_id = e.role_id','left');
$this->db->where('e.emp_id',$emp_id);
$query=$this->db->get();
if($query->num_rows() > 0)
{
return $query->row();
}
}
public function update_Admin_Profile($emp_id)
{
//$data = $this->Loginm->getEmployeeProfile($emp_id); Your Code
$data['data'] = $this->Loginm->getEmployeeProfile($emp_id); //Change to this line
$this->load->view('admin/header',$data);
$this->load->view('admin/sidebar',$data);
$this->load->view('employee/update_Admin_Profile',$data);
$this->load->view('admin/footer');
}
and in view you can fetch like the following code:
<?php echo ($data[0]->sub_dept_name);?>
Let's take the example:
You are getting the data from model like,
$data = array('gender' => 'male', 'age' => 22)
Then to access in codeigniter view you need to echo array's key as a variable
example:
<?php echo $gender; ?>

Product category function not working in CodeIgniter

I'm making a website in CodeIgniter and I'm trying to make a menu bar with all the categories, and when you click on a certain category it must show all the products that are in that category but its not really working.
The categories are showing on the category side menu bar, but when I click on a certain category link its going to the right view page but instead of the product information I'm getting this error:
A PHP Error was encountered
Severity: Error
Message: Cannot use object of type stdClass as array
Filename: views/category.php
Line Number: 41
Backtrace:
Line 41 in category.php is this line:
<a href="<?php echo base_url() ?>/Product/details/<?php echo $product['product_id']; ?>">
So I'm guessing it can't echo product detail information?
Here is my Allecadeaus controller to echo products:
<?php
class AlleCadeausController extends CI_Controller {
public function index()
{
$this->load->model('Product_model');
$this->load->model('allecadeaus_model');
$data['products'] = $this->allecadeaus_model->get_products();
$this->load->view('allecadeaus', $data);
}
}
My Allecadeaus_model model file which I use to echo products:
<?php
class Allecadeaus_model extends CI_Model {
public function __construct()
{
parent::__construct();
}
public function get_products()
{
$query = $this->db->query('SELECT * FROM products');
$result = $query->result_array();
return $result;
}
}
category.php view file:
<?php include_once ('templates/header.php'); ?>
<!-- Alle cadeaus gele title bovenaan pagina -->
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 bg-warning" style="font-size:25px">
<center>Alle cadeaus</center>
</div>
</div>
</div>
<hr />
<br>
<!-- Cadeau categorie side menu -->
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
<div id="categorymenu">
<center> <h3>Categorieën</h3> </center>
<ul class="list-group">
<?php foreach (get_categories_h() as $category) : ?>
<li class="list-group-item">
<?php echo $category->name; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<!-- Laat cadeau zien op alle cadeaus pagina -->
<div class="col-md-8">
<?php foreach($products as $product) : ?>
<div class="col-md-2">
<div id="product">
<a href="<?php echo base_url() ?>/Product/details/<?php echo $product['product_id']; ?>">
<img src="<?php echo base_url(); ?>upload/<?php echo $product['product_foto_thumb']; ?>">
</a>
<div class="product_naam"><?php echo $product['product_naam']; ?></div>
<div class="ophaal_plaats">
<?php echo $product['ophaal_plaats']; ?>
</div>
<div class="aangeboden_door">
<p>Aangeboden door: Peter</p>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="clearfix"></div>
<?php include_once ('templates/footer.php'); ?>
My whole allecadeaus.php view file:
<?php include_once ('templates/header.php'); ?>
<!-- Alle cadeaus gele title bovenaan pagina -->
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 bg-warning" style="font-size:25px">
<center>Alle cadeaus</center>
</div>
</div>
</div>
<hr />
<br>
<!-- Cadeau categorie side menu -->
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
<div id="categorymenu">
<center> <h3>Categorieën</h3> </center>
<ul class="list-group">
<?php foreach (get_categories_h() as $category) : ?>
<li class="list-group-item">
<?php echo $category['name']; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<!-- Laat cadeau zien op alle cadeaus pagina -->
<div class="col-md-8">
<?php foreach($products as $product) : ?>
<div class="col-md-2">
<div id="product">
<a href="<?php echo base_url() ?>/Product/details/<?php echo $product['product_id']; ?>">
<img src="<?php echo base_url(); ?>upload/<?php echo $product['product_foto_thumb']; ?>">
</a>
<div class="product_naam"><?php echo $product['product_naam']; ?></div>
<div class="ophaal_plaats">
<?php echo $product['ophaal_plaats']; ?>
</div>
<div class="aangeboden_door">
<p>Aangeboden door: Peter</p>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="clearfix"></div>
<?php include_once ('templates/footer.php'); ?>
My Product.php controller file:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Product extends CI_Controller {
var $data = array();
public function index()
{
//Laad kado uploaden view
$this->load->view('product_form', $this->data);
}
public function details($product_id)
{
//load the Product_model
$this->load->model('Product_model');
//call function getdata in de Product_model
$data['userdetail_list'] = $this->Product_model->getdata();
//get product details
$data['product'] = $this->Product_model->get_product_details($product_id);
//laad view
$data['main_content'] = 'details';
$this->load->view('details',$data);
}
//categorie product function
public function category($id)
{
$data['title'] = 'Category';
$data['page'] = 'Product/category';
$data['category'] = $this->Category_model->findByCategory($id);
$data['products'] = $this->Product_model->findByCategory($id);
$this->Category_model->findByCategory($id);
$this->load->view('category', $data);
}
public function __construct()
{
parent::__construct();
$this->load->model('Product_model');
$this->load->helper(array('form', 'url'));
}
My Product_model file:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Product_model extends CI_model {
public function saveProduct($data) {
$this->db->insert('products', $data);
$product_id = $this->db->insert_id();
return $product_id;
}
public function getdata()
{
$this->db->select('users.user_id,users.email,users.voornaam,products.product_id,products.category_id,products.product_naam');
$this->db->from('users');
$this->db->join('products','products.user_id = users.user_id');
$query = $this->db->get();
if($query->num_rows()>0)
{
return $query->result_array();
}
}
public function get_product_details($product_id) {
$arrReturn = array();
$this->db->select('*');
$this->db->from('products');
$this->db->where('product_id', $product_id);
$query = $this->db->get();
$result = $query->result_array();
if (!empty($result)) {
$arrReturn = $result[0];
}
return $arrReturn;
}
/*
Get categories
*/
public function get_categories(){
$this->db->select('*');
$this->db->from('categories');
$query = $this->db->get();
$result = $query->result();
return $result;
}
public function findAll(){
return $this->db->get('products')->result();
}
public function findByCategory($id){
$this->db->where('id', $id);
return $this->db->get('categories')->result();
}
}
?>
My Category_model file:
<?php
class Category_model extends CI_Model {
public function findAll(){
$this->db->get('categories')->result();
}
public function findByCategory($id)
{
$this->db->where('id', $id);
$this->db->get('categories')->result();
return $this->db->get('categories')->row();
}
}
?>
My db_helper.php
<?php if (!function_exists('get_categories_h')) {
function get_categories_h(){
$CI = get_instance();
$categories = $CI->Product_model->get_categories();
return $categories;
} } ?>
Some database information:
Table 1: 5 columns: products
-product_id
-product_naam
-product_beschrijving
-user_id
-category_id
table 2: categories: 2 columns:
1.id
2.name
You can try this solution for your problem:
Whole allecadeaus.php view file:
<ul class="list-group">
<?php foreach (get_categories_h() as $category) : ?>
<li class="list-group-item">
<?php echo $category->name; ?>
</li>
<?php endforeach; ?>
</ul>
is your database already have the filed category_id, is the name correct? can you show screen from your categories and products table?

How to change data variable value in codeigniter?

I'm trying to create a search form in codeigniter. This is my controller and model,
Shop.php [ Controller ]
public function s(){
$q = $this->input->get('q');
if( $q == null ){
$this->index();
}
$data['products'] = $this->product_model->search_products( $q );
$this->load->view('shop', $data);
}
Product_model.php
public function search_products( $keyword ){
$this->db->select('product.id, product.product_name, product.product_description, product.product_image1,
brand.brand_name, category.category_name, type.type_name, stock.selling_price,
(SELECT COALESCE(ROUND(SUM(rate)/( COUNT(rate)*5 )*100), 0) FROM rating WHERE rating.product_id = product.id)AS rating,
(SELECT COALESCE(COUNT(rating.id), 0) FROM rating WHERE rating.product_id = product.id)AS rate_count');
$this->db->from('product');
$this->db->join('stock','stock.product_id = product.id');
$this->db->join('brand', 'brand.id = product.brand_id');
$this->db->join('category', 'category.id = product.category_id');
$this->db->join('type', 'type.id = product.type_id');
$this->db->join('color', 'color.id = product.color_id');
$this->db->where('MATCH(product.product_name) AGAINST("'.$keyword.'")');
$this->db->or_where('MATCH(brand.brand_name) AGAINST("'.$keyword.'")');
$this->db->or_where('MATCH(category.category_name) AGAINST("'.$keyword.'")');
$this->db->or_where('MATCH(type.type_name) AGAINST("'.$keyword.'")');
$this->db->where('stock.qty >', 0);
$this->db->group_by('product.id');
$query = $this->db->get();
return $query->result_array();
}
But return value in null. So I tried calling search_product( $keyword ) function in my view and it worked. but when I print $data['product'] variable and its empty.
What is the problem here? Thank you.
Edit
The search result shows here.
<div class="row product-list-item">
<?php
// This is just used for check the query
$p = $this->product_model->search_products( 'mesh' );
echo '<br>';
print_r($products);
if( $products != null ){
foreach ( $products as $product ){
?>
<!-- item.2 -->
<div class="product-item-element col-sm-6 col-md-6 col-lg-4">
<!--Product Item-->
<div class="product-item">
<div class="product-item-inner">
<div class="product-img-wrap">
<img src="<?php echo base_url($product['product_image1']);?>" alt="">
</div>
<div class="product-button">
<i class="fa fa-eye"></i>
</div>
</div>
<div class="product-detail">
<p class="product-title"><a href="<?php echo site_url('shop/view/'.$product['id'])?>">
<?php echo $product['product_name']; ?>
</a></p>
<div class="product-rating">
<div class="star-rating" itemprop="reviewRating" itemscope="" itemtype="" title="Rated 4 out of 5">
<span style="width: <?php echo $product['rating'];?>%"></span>
</div>
<a href="#" class="product-rating-count">
<span class="count"><?php echo $product['rate_count'];?></span> Reviews
</a>
</div>
<p class="product-description">
<?php echo $product['product_description']; ?>
</p>
<h5 class="item-price"><?php echo $product['selling_price']; ?></h5>
</div>
</div>
<!-- End Product Item-->
</div>
<?php
}
}else{
?>
<div class="text-center no-items">
<h4>No items</h4>
</div>
<?php } ?>
</div>

Categories