load->library('Pagination');
$this->load->model('Barang');
$this->load->model('Kategori');
}
public function index($kate = '')
{
if (empty($kate)){
//ambil data kategori
//ambil data semua barang
//pagination
//$hd['title'] = "Toko Dzaky Mulya";
//$data['active'] = "Produk";
//$data['barang'] = $this->Barang->barang_all();
//$data['kategori'] = $this->Kategori->kategori_all();
//$this->load->view('front/header',$hd);
//$this->load->view('front/shopstep');
//$this->load->view('front/produk',$data);
//$this->load->view('front/footer');
$this->paging();
}
else{
echo $kate;
$this->paging($kate);
}
}
public function paging($kat="")
{
$barang = $this->Barang->barang_all();
$config['base_url'] = base_url()."index.php/product/paging";
$config['total_rows'] = count($barang);
$config['per_page'] = "6";
$config["uri_segment"] = 3;
$choice = $config["total_rows"] / $config["per_page"];
$config["num_links"] = floor($choice);
$config['full_tag_open'] = "
";
$config['num_tag_open'] = '';
$config['num_tag_close'] = '';
$config['cur_tag_open'] = "";
$config['cur_tag_close'] = "";
$config['next_tag_open'] = "";
$config['next_tagl_close'] = "";
$config['prev_tag_open'] = "";
$config['prev_tagl_close'] = "";
$config['first_tag_open'] = "";
$config['first_tagl_close'] = "";
$config['last_tag_open'] = "";
$config['last_tagl_close'] = "";
$this->pagination->initialize($config);
$data['page'] = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
$data['barang'] = $this->Barang->barang_all2($config["per_page"],$data['page']);
$hd['title'] = "Toko Dzaky Mulya";
$data['active'] = "Produk";
$data['kategori'] = $this->Kategori->kategori_all();
$data['pagination'] = $this->pagination->create_links();
$this->load->view('front/header',$hd);
$this->load->view('front/shopstep');
$this->load->view('front/produk',$data);
$this->load->view('front/footer');
}
public function top_prodct(){
//ambil data produk dengan sales paling banyak
//buat
}
public function new_prodct(){
//ambil data produk dengan sales paling banyak
//buat
}
public function kategori($kat){
//ambil data dengan kategori tertentu
$w = array(
'kategori' => $kat
);
$data = $this->barang->barang_cust($w);
//tampilkan
//pagination
}
}