Rev 11805 | Rev 11813 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');class Privatedeals extends MY_Controller {public $layoutName ='';function __construct() {// Call the CI_controller constructorparent::__construct();$authorized = $this->session->userdata('authorized');if(!isset($authorized) || empty($authorized)){redirect(base_url().'auth/login');}$this->layout->setlayout('layout/layout_main');$this->load->model('privatedeal_model');$this->load->model('magento_model');$this->layoutName= $this->layout->getLayout();$this->layoutName =substr($this->layoutName , 0, strrpos($this->layoutName , "/")).'/';}public function index(){$userId = $this->session->userdata['authorized']['Id'];$data = array();//get cache$configdata =array();$configdata = $this->config->item('privatedeals');$name = $configdata['response'];foreach ($name as $key => $value) {$name = $value;}$cachemodule = array('header','footer');$configdata = getCache($configdata,$cachemodule);$data['response']=$this->privatedeal_model->getProducts('',$this->input->post(),$configdata['module'], $userId);print_r($data['response']['private_deals']);if(isset($data['response']['private_deals'][0]->response->redirectUrl)) {redirect($data['response']['private_deals'][0]->response->redirectUrl);exit();}//set cache to output or renew cacheif(isset($cachemodule) and !empty($cachemodule)){foreach($cachemodule as $cm){if(isset($configdata[$cm]) and !empty($configdata[$cm])){$data['response'][$cm]=$configdata[$cm];}}}setCache($configdata['module'],$cachemodule,$data['response']);$this->lessphp->object()->ccompile('assets/css/pd-list.less','assets/css/pd-list.css');$data['stylesheet'] = 'pd-list.css';//TODO: Get coupon code from api$data['response']['couponcode'] = "saholicdeal";$this->layout->view('privatedeals/products_view',$data);}}