kevinnn Posted December 2, 2017 Share Posted December 2, 2017 Hi all, I'm using Prestashop 1.6.0.14 and I'm trying to get the customer address in my module with the hook "hookActionOrderStatusUpdate". My code: $var_order_status = $params['newOrderStatus']->id; $var_id_order = (int)$params['id_order']; $order = new Order($var_id_order); $var_id_cart = (int)$order->id_cart; $cart = new Cart($var_id_cart); $var_id_address = $cart->id_address_invoice; $address = new Address($var_id_address); The $var_id_address DOES contain an id, but the variable $address isn't created. What am I doing wrong? How can I retrieve the customer address (so not shipping address)? I need the ZIP code and street name. Thanks. - Kevin. Link to comment Share on other sites More sharing options...
bellini13 Posted December 2, 2017 Share Posted December 2, 2017 I would first abbreviate the code to the following. There is no need to look at the cart object, since the order object would have the most update to date address information. $var_order_status = $params['newOrderStatus']->id; $var_id_order = (int)$params['id_order']; $order = new Order($var_id_order); $var_id_address = $order->id_address_invoice; $address = new Address($var_id_address); Now if the Address object is not valid, you should debug that by checking the value of id_address_invoice obtained from the Order object. The value should be an int greater than zero. If it is, then go to your database and confirm that the ps_address table has a record with that address. If it is zero, then somehow your order or address records got corrupt, and I'm not sure how to help you with that. 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