There is another post on Stack Overflow that includes the following code for serving multiple product templates based on product ID
//42 is the id of the product
if ($this->request->get['product_id'] == 42) {
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/customproduct.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/customproduct.tpl';
} else {
$this->template = 'default/template/product/customproduct.tpl';
}
} else {
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/customproduct.tpl';
}
}
I would like to check for an alternate product field value that I won't be using instead of ID so it is something that can be managed from the admin panel.
For example, a statement that reads "If product location = accessory then get product/accessory.tpl"
Would I have to load that field in the product controller before I can request it with the if statement?
What would the syntax look like?