opencart - Checking multiple conditions in PHP 'if' statement -


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';     } } 

i wanna achieve if product id 53 or 50 or 43 then...the same thing..but not sure correct this

you can store product ids in array use in_array() function:

if (in_array($this->request->get['product_id'], array (53, 52, 43))) { 

in_array - checks if value exists in array


Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -