Unique Made Posted November 8, 2018 Share Posted November 8, 2018 Hi all, I am quite new to developing for PrestaShop. For educational purposes I am trying to rewrite an extension I previously made for another platform. This module will hook in on a statusupdate, and first checks the new status to decide whether to proceed or stop. For this I will use a configuration value. Now it works if I set it manually, but I'd like to have a pull-down list of existing values in my configuration page, so the user can select the right state to start this module... I cannot figure out how to get a list of existing orderstates. I should be able to call the function 'getOrderStates' in 'classes/order/orderstate.php' but I cannot figure out how. I think the missing link is how to include or use the mentioned php file, but the spare examples of code I see don't include anything at all... Any help is welcome! Link to comment Share on other sites More sharing options...
Unique Made Posted November 8, 2018 Author Share Posted November 8, 2018 Somehow, writing things down always gets you a step further. For anyone searching for the same, the solution is: You don't have to 'include' or 'use' the class, it;'s already there. 1- Create a new 'orderState' object 2- Run the function 'getOrderStates' $states = new OrderState(1); //the id is possibly not required, did not try without $states2 = $states->getOrderStates(1); // the id is the language id, 1 is probably always English? $states2 is now an array containing all OrderStates as defined in your store: Array ( [0] => Array ( [id_order_state] => 10 [invoice] => 0 [send_email] => 1 [module_name] => ps_wirepayment => #4169E1 [unremovable] => 1 [hidden] => 0 [logable] => 0 [delivery] => 0 [shipped] => 0 [paid] => 0 [pdf_invoice] => 0 [pdf_delivery] => 0 [deleted] => 0 [id_lang] => 1 [name] => Awaiting bank wire payment [template] => bankwire ) [1] => Array --> etcetera 1 2 Link to comment Share on other sites More sharing options...
Maneesh Posted March 4, 2020 Share Posted March 4, 2020 Thanks it's working for 1.5.6 Best Regards Maneesh Tiwari 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