if($this->request->get['product_id'] == (53 || 52 || 43)){
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/product2.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/product2.tpl';
} else {
$this->template = 'default/template/product/product2.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/product.tpl';
}
}
Run Code Online (Sandbox Code Playgroud)
我想实现它,如果产品ID是53或50或43然后......同样的事情..但我不确定它是这样的正确
您可以将产品ID存储在数组中,然后使用以下in_array()函数:
if (in_array($this->request->get['product_id'], array (53, 52, 43))) {
Run Code Online (Sandbox Code Playgroud)
in_array- 检查数组中是否存在值