CriMsonK20 Posted April 28, 2010 Share Posted April 28, 2010 What I'm trying to do is connect an external order motion API into a presta based cron job that will take the shipping status from Order Motion and return it to prestashop by creating a new OrderHistory object and assigning an order status to it.The issue I am having is in my script, I am using practically the same code that is listed in AdminOrders.php which allows you to change the order status in the back end. My code is as follows: $history = new OrderHistory(); $id_order = intval($history->GetOrderByOMXID($orderNumber[1])); // custom function $order = new Order($id_order); $history->id_order = $id_order; $history->id_employee = 1; $history->id_order_state = $newOrderStatusID; $history->date_add = date("n/j/Y",time()); $history->date_upd = date("n/j/Y",time()); $os = new OrderState(4); print_r($os); $os is a test object to see what is contained when the OrderState constructor is called. When I output the OrderState object in OrderHistory->changeIdOrderState() it has a valid order state object. I have verified that my function is getting the right params and everything checks out.. This is why I hard coded the $os object. If I'm passing 4 as a parameter, and 4 is a valid OrderState ID, it should get a valid object. When I output the value of $os, I get an empty object with no values.Any ideas as to why this is happening? It is in the OrderHistory class that changeIdOrderState is called, and if I call it from the back end, it works, but if I call it from my script it does not return an object. Link to comment Share on other sites More sharing options...
CriMsonK20 Posted April 29, 2010 Author Share Posted April 29, 2010 anybody have any input on this? Link to comment Share on other sites More sharing options...
CriMsonK20 Posted May 21, 2010 Author Share Posted May 21, 2010 any input? seems to be a lack of developers working with this. Link to comment Share on other sites More sharing options...
phunter121 Posted April 30, 2011 Share Posted April 30, 2011 Did you manage to resolved this, I need to do something similar? Link to comment Share on other sites More sharing options...
Burhan BVK Posted April 30, 2011 Share Posted April 30, 2011 If you check the PaymentModule class you will see how it is done. $new_history = new OrderHistory(); $new_history->id_order = (int)$order->id; $new_history->changeIdOrderState((int)$id_order_state, (int)$order->id); 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