public function index()
 {
     $this->language->load('catalog/wkallauctions');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->load->model('account/customer');
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false);
     $this->document->addScript('catalog/view/javascript/wkproduct_auction/jquery.countdown.js');
     $this->document->addStyle('catalog/view/theme/default/stylesheet/wkauction/wkallauctions.css');
     $this->document->addScript('catalog/view/javascript/wkproduct_auction/jquery.quick.pagination.min.js');
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['entry_empty'] = $this->language->get('entry_empty');
     //		$this->load->model('catalog/wkallauctions');
     $this->data['allauctions'] = array();
     $wkauctions = WKProductAuctionDAO::getInstance()->getAuctions();
     foreach ($wkauctions as $wkau) {
         $this->data['allauctions'][] = array('product_id' => $wkau['product_id'], 'aumin' => $this->currency->format($wkau['min']), 'aumax' => $this->currency->format($wkau['max']), 'austart' => $wkau['start_date'], 'auend' => $wkau['end_date'], 'name' => $wkau['name'], 'image' => $wkau['image']);
     }
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/catalog/wkallauctions.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/catalog/wkallauctions.tpl';
     } else {
         $this->template = 'default/template/catalog/wkallauctions.tpl';
     }
     $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
     $this->getResponse()->setOutput($this->render());
 }
 protected function index()
 {
     //LOAD LANGUAGE
     $this->language->load('module/wkproduct_auction');
     //SET TITLE
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['entry_auction'] = $this->language->get('entry_auction');
     $this->data['entry_winner'] = $this->language->get('entry_winner');
     $this->data['entry_time_left'] = $this->language->get('entry_time_left');
     $this->data['entry_bids'] = $this->language->get('entry_bids');
     $this->data['entry_min_price'] = $this->language->get('entry_min_price');
     $this->data['entry_max_price'] = $this->language->get('entry_max_price');
     $this->data['entry_start_time'] = $this->language->get('entry_start_time');
     $this->data['entry_close_time'] = $this->language->get('entry_close_time');
     $this->data['entry_your_price'] = $this->language->get('entry_your_price');
     $this->data['entry_thnaks'] = $this->language->get('entry_thnaks');
     $this->data['entry_no_bids'] = $this->language->get('entry_no_bids');
     $this->data['entry_bids_error'] = $this->language->get('entry_bids_error');
     $this->data['entry_ammount_error'] = $this->language->get('entry_ammount_error');
     $this->data['entry_login_error'] = $this->language->get('entry_login_error');
     $this->data['entry_ammount_less_error'] = $this->language->get('entry_ammount_less_error');
     $this->data['entry_ammount_range_error'] = $this->language->get('entry_ammount_range_error');
     //LOAD MODEL FILES
     $this->load->model('module/wkproduct_auction');
     $this->document->addScript('catalog/view/javascript/wkproduct_auction/countdown.js');
     $this->document->addStyle('catalog/view/theme/default/stylesheet/wkauction.style.css');
     $this->load->model('catalog/product');
     $results = array();
     $this->data['winner'] = 0;
     $this->data['timeout'] = 0;
     $this->data['auction_id'] = '';
     $this->data['min'] = '';
     $this->data['max'] = '';
     $this->data['end'] = '';
     $this->data['start'] = '';
     if (isset($this->request->get['product_id'])) {
         $results = WKProductAuctionDAO::getInstance()->getAuction($this->request->get['product_id']);
     }
     date_default_timezone_set($this->config->get('wk_auction_timezone_set'));
     //date_default_timezone_set(TIMEZONE);
     if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) {
         $this->data['base'] = $this->config->get('config_ssl');
     } else {
         $this->data['base'] = $this->config->get('config_url');
     }
     $count = 0;
     foreach ($results as $result) {
         $this->data['auction_id'] = $result['id'];
         $this->data['min'] = $this->currency->format($result['min']);
         $this->data['max'] = $this->currency->format($result['max']);
         $this->data['end'] = $result['end_date'];
         $this->data['start'] = $result['start_date'];
         $dat = date('Y-m-d H:i:s');
         if ($result['start_date'] <= $dat && $result['end_date'] >= $dat) {
             //print_r($dat);
             //die();
             $this->data['timeout'] = 1;
         } elseif ($count == 0) {
             $this->model_module_wkproduct_auction->updateAuctionbids($this->data['auction_id']);
         }
         $count = $count + 1;
     }
     $bids = array();
     if (isset($this->data['auction_id'])) {
         $bids = WKProductAuctionDAO::getInstance()->getAuctionbids($this->data['auction_id']);
     }
     $this->data['my_bids'] = array();
     foreach ($bids as $bid) {
         $this->data['my_bids'][] = array('user_id' => $bid['user_id'], 'auction_id' => $bid['auction_id'], 'user_bid' => $bid['user_bid'], 'winner' => $bid['winner']);
     }
     $this->id = 'wk_contact';
     //CHOOSE TEMPLATE
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/wkproduct_auction.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/module/wkproduct_auction.tpl';
     } else {
         $this->template = 'default/template/module/wkproduct_auction.tpl';
     }
     //RENDER
     $this->render();
 }