<?php
/*
* @Author: Daljit Katoch
* Gitgub: https://github.com/daljitkatoch
*/
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Shop extends MY_Controller
{
private $num_rows = 20;
public function __construct()
{
parent::__construct();
$this->load->model(array('Shop_model'));
$this->load->helper('pagination');
}
public function index($page = 0)
{
$head = $data = array();
$head['title'] = 'Once Wron Bridal | Shop';
$head['keywords'] = '';
$head['description'] = 'Once worn bridal is an online platform whereby buyer and seller are enable to easily complete the transaction with peacr of mind.We are firm advocates of sustainability and stongly believe that a beautiful wedding garment should never only be Worn Once.Our mission is to reduce the environmental footprint of the bridal industry, which has traditionally been very single use orientated.';
$start = $page;
$rowscount = $this->Shop_model->productsCount($_GET);
$data['designers'] = $this->Shop_model->getDesigners();
$data['products'] = $this->Shop_model->getProducts($this->num_rows, $start, $_GET);
$data['rowscount'] = $rowscount;
$data['rowperpage'] = $this->num_rows;
$url = base_url('shop');
$data['links_pagination'] = pagination($url, $rowscount, $this->num_rows, 2);
$this->render('shop/shop', $head, $data);
}
public function next_records($page = 0)
{
$data = array();
$data['products'] = $this->Shop_model->getProducts($this->num_rows, $page, $_GET);
$rowscount = $this->Shop_model->productsCount($_GET);
$this->load->view('shop/next_records', $data);
}
public function shopajax($page = 0)
{
$start = $page;
$rowscount = $this->Shop_model->productsCount($_GET);
$data['products'] = $this->Shop_model->getProducts($this->num_rows, $start, $_GET);
$data['rowscount'] = $rowscount;
$data['rowperpage'] = $this->num_rows;
$url = base_url('shop');
$data['links_pagination'] = pagination($url, $rowscount, $this->num_rows, 2);
$this->load->view('shop/shopajax', $data);
}
public function view($id)
{
$head = $data = array();
$head['title'] = 'Once Wron Bridal | Wedding Dress';
$head['keywords'] = '';
$head['description'] = 'Once worn bridal is an online platform whereby buyer and seller are enable to easily complete the transaction with peacr of mind.We are firm advocates of sustainability and stongly believe that a beautiful wedding garment should never only be Worn Once.Our mission is to reduce the environmental footprint of the bridal industry, which has traditionally been very single use orientated.';
$data['product'] = $this->Shop_model->getProduct($id);
if(empty($data['product'])){
show_404();
}
$designer_id = $data['product'][0]['designer'];
if(isset($designer_id)){
$data['designer'] = $this->Shop_model->getDesigner($designer_id);
}
$user_id = $data['product'][0]['for_id'];
if(isset($user_id) && $user_id != 0){
$data['seller'] = $this->Shop_model->getSeller($user_id);
$country_code = $data['seller'][0]['country'];
if(isset($country_code)){
$data['country'] = $this->Shop_model->getCountry($country_code);
}
}else{
$data['seller'] = $data['country'] = "";
}
$data['similar_products'] = $this->Shop_model->getSimilarProducts(10, 0);
//check wishlist
$user_id = @$this->front_user['user_id'];
if($user_id){
$data['in_wishlist'] = $this->Shop_model->in_wishlist($id, $user_id);
}else{
$data['in_wishlist'] = "";
}
$this->render('shop/single_product', $head, $data);
}
}
|