Guillaume_MPS Posted June 29, 2015 Share Posted June 29, 2015 Hello, I need to get the first order state in a module payment to validate the order. There is a getCurrentState() method in the order class file, but there is no "getFirstState()" method Is someone could help me ? Guillaume Link to comment Share on other sites More sharing options...
bellini13 Posted June 30, 2015 Share Posted June 30, 2015 you would have to create a custom SQL query, something like this will return the first order state for a specified order. SELECT id_order_state FROM `ps_order_history` WHERE id_order = 7 order by `id_order_history` limit 1 Link to comment Share on other sites More sharing options...
Guillaume_MPS Posted July 1, 2015 Author Share Posted July 1, 2015 Thank you Bellini13, For my case (I need to know if the first order state is "payment accepted"), I choose to call the Order function hasBeenPaid(). But I thank you for your SQL query. For my knowledge, could you give me an example of object-oriented code with Prestashop classes ? Link to comment Share on other sites More sharing options...
bellini13 Posted July 1, 2015 Share Posted July 1, 2015 For my case (I need to know if the first order state is "payment accepted"), I choose to call the Order function hasBeenPaid(). That is fine, but that is not what you asked for originally, which was... I need to get the first order state in a module payment to validate the order. The Prestashop codebase is littered with examples of OOO, for example look at the function getAddressIdBySupplierId in the Address class 1 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