bonsaiko Posted February 18, 2019 Share Posted February 18, 2019 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 More sharing options...
Nishith Nesdiya Posted February 19, 2019 Share Posted February 19, 2019 Hi... can you develop custom module ? then use actionOrderStatusPostUpdate hook in your module thanks Link to comment Share on other sites More sharing options...
bonsaiko Posted February 19, 2019 Author Share Posted February 19, 2019 Hello, I was able to use the hook to do what I want but this is not my point. I'd like to be able to use a variable instead of using the number "21". See what I mean ? Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted February 19, 2019 Share Posted February 19, 2019 (edited) 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 February 19, 2019 by Nishith (see edit history) Link to comment Share on other sites More sharing options...
bonsaiko Posted February 19, 2019 Author Share Posted February 19, 2019 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 More sharing options...
Nishith Nesdiya Posted February 20, 2019 Share Posted February 20, 2019 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 2 Link to comment Share on other sites More sharing options...
bonsaiko Posted February 20, 2019 Author Share Posted February 20, 2019 Thanks a lot, that's what I needed. Actually i did : SELECT * FROM ps_configuration WHERE value = '21' And I got the variable name that I was looking for, which is PS_OS_OUTOFSTOCK_UNPAID Thank you very much. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now