Post by joegti10 » Tue Jan 20, 2015 4:56 am

I have a store in which one 'product' needs to use a different product/product.tpl file. I see some help code from 1.5 where some things are added to the controller file but it looks like the code in there has changed in 2.0.

Any help would be greatly appreciated.

New member

Posts

Joined
Sun Sep 05, 2010 1:49 am

Post by joegti10 » Tue Jan 20, 2015 5:25 am

Think I figured it out with some help from the old 1.5 notes.

In controller/product/product.php

Changed

Code: Select all

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/product.tpl')) {
	$this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/product/product.tpl', $data));
} else {
	$this->response->setOutput($this->load->view('default/template/product/product.tpl', $data));
}
To

Code: Select all

if($this->request->get['product_id'] == '55') {  // If ID matches this, use this new template
   if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/product_new.tpl')) {
      $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/product/product_new.tpl', $data));
   } else {
	  $this->response->setOutput($this->load->view('default/template/product/product.tpl', $data));
   }
} else {  // If not, use standard
   if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/product.tpl')) {
      $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/product/product.tpl', $data));
   } else {
	  $this->response->setOutput($this->load->view('default/template/product/product.tpl', $data));
   }
}

New member

Posts

Joined
Sun Sep 05, 2010 1:49 am
Who is online

Users browsing this forum: No registered users and 3 guests