Jump to content

Help with Tools::getValue


Recommended Posts

Hello,

 

I want to use this code:

 

if(file_exists(_PS_MODULE_DIR_.'pc_orderspanel/views/templates/admin/_configure/'.$this->base_folder.$tpl_name) && Tools::getValue('controller') != 'AdminProductGrid' && Tools::getValue('controller') != 'AdminProducts')

 

Somehow it is not working.

 

If i remove a part and use this code it is working:

 

if(file_exists(_PS_MODULE_DIR_.'pc_orderspanel/views/templates/admin/_configure/'.$this->base_folder.$tpl_name) && Tools::getValue('controller') != 'AdminProductGrid')

 

How can i add: && Tools::getValue('controller') != 'AdminProducts'

 

Thanks!

 

Luke

Link to comment
Share on other sites

Tools::getValue returns boolean false if the parameter does not exist in GET or POST. 

 

So this may not work as you think it does

Tools::getValue('controller') != 'AdminProducts')

 

get the value of controller before your if statement, and then check that it has a non-boolean value before executing your if statement

Link to comment
Share on other sites

Thanks for you reply. If i Put AdminProducts in the place of AdminProductGrid then the AdminProducts page is working. I have to find a way to combine those two.

 

if(file_exists(_PS_MODULE_DIR_.'pc_orderspanel/views/templates/admin/_configure/'.$this->base_folder.$tpl_name) && Tools::getValue('controller') != 'AdminProducts')

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...