Page 1 of 1

Apply a New Product Template by category

Posted: Fri Nov 30, 2012 11:00 pm
by aha56
Hi there,
Forgive me if I'm about to say something daft - I am a beginner at opencart and php.
I am using Opecart Version

I have found/ created a way to apply a different product template to a single product. This was done by adding the following code into the file at catalog/controller/product/product.php -

Code: Select all

			if($this->request->get['product_id'] == '500') {  // If ID matches this, use this new template
			   if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/product_new.tpl')) {
				  $this->template = $this->config->get('config_template') . '/template/product/product_new.tpl';
			   } else {
				  $this->template = 'default/template/product/product.tpl';
			} else {  // If not, use standard
			   if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/product.tpl')) {
				  $this->template = $this->config->get('config_template') . '/template/product/product.tpl';
			   } else {
				 $this->template = 'default/template/product/product.tpl';
What I would like to do is find a way so that all products within a certain category are sent to the product_new template. Can anybody help?