shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

ebay_listing.php (1540B)


      1 <?php
      2 class ControllerExtensionModuleEbayListing extends Controller {
      3 	public function index() {
      4 		if ($this->config->get('ebay_status') == 1) {
      5 			$this->load->language('extension/module/ebay');
      6 			
      7 			$this->load->model('tool/image');
      8 			$this->load->model('extension/openbay/ebay_product');
      9 
     10 			$data['heading_title'] = $this->language->get('heading_title');
     11 
     12 			$data['products'] = array();
     13 
     14 			$products = $this->cache->get('ebay_listing.' . md5(serialize($products)));
     15 
     16 			if (!$products) {
     17 				$products = $this->model_extension_openbay_ebay_product->getDisplayProducts();
     18 				
     19 				$this->cache->set('ebay_listing.' . md5(serialize($products)), $products);
     20 			}
     21 
     22 			foreach($products['products'] as $product) {
     23 				if (isset($product['pictures'][0])) {
     24 					$image = $this->model_extension_openbay_ebay_product->resize($product['pictures'][0], $this->config->get('ebay_listing_width'), $this->config->get('ebay_listing_height'));
     25 				} else {
     26 					$image = $this->model_tool_image->resize('placeholder.png', $this->config->get('ebay_listing_width'), $this->config->get('ebay_listing_height'));
     27 				}
     28 
     29 				$data['products'][] = array(
     30 					'thumb' => $image, 
     31 					'name'  => base64_decode($product['Title']), 
     32 					'price' => $this->currency->format($product['priceGross'], $this->session->data['currency']), 
     33 					'href'  => (string)$product['link']
     34 				);
     35 			}
     36 
     37 			$data['tracking_pixel'] = $products['tracking_pixel'];
     38 
     39 			return $this->load->view('extension/module/ebay', $data);
     40 		}
     41 	}
     42 }