Jump to content

Get Prestashop order state code


bonsaiko

Recommended Posts

Hello,

I had to do a small development that will check if the order state is 

Configuration::get('PS_OS_ERROR')

and also I need to check another value for order state. 

I found out that the value that I have to check is "21". 

But I don't want to compare my order state to 21. I'd like to be able to compare it to the variable.

For example something like :

Configuration::get('PS_OS_MY_ORDER_STATE')

But I don't know how to find out this variable name...

Could you please help me ?

 

Thanks a lot.

Link to comment
Share on other sites

 

if you need use variable  instead number the store the value in database like  

//save the value in Configuration table in databse
Configuration::updateValue('YOUR_NAME_ORDER', 21);

//get the value from Configuration table
Configuration::get('YOUR_NAME_ORDER');

//Then after compare value with your order status

public function hookActionOrderStatusPostUpdate($params)
{
	$newOrderStatus = $params['newOrderStatus'];
	if($newOrderStatus->id == Configuration::get('YOUR_NAME_ORDER')) {
      //your code here
    }
}

Thanks

 

Edited by Nishith (see edit history)
Link to comment
Share on other sites

Thanks for your answer, I appreciate that you're taking some time to help me. 

However you did not understand my issue - I'm sorry if I was not clear in the first place. Let me try to explain it again :)

The value already exists, I mean there is already in the database an order state that has a value of 21. 

But I don't know what is the variable name. 

For example I know that there is an order state that has the value of 8, and the matching variable is 

PS_OS_ERROR

But I don't know what is the variable name for the order state that has the value 21 and that is already created. 

This is what I'm trying to know.

Is it clearer now ?

Thanks

Link to comment
Share on other sites

Hi..
the first you need to check the prestashop 'ps_configuration' table in your database like this query if your value exit or not ?

SELECT * FROM `ps_configuration` WHERE `name` LIKE '%PS_OS%'

if you not find then you need to add the new name with your value in  'ps_configuration'

in my case see image

Thanks

Capture.PNG

  • Like 2
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...