Jump to content

Getting customer details and shipping details for specific order.


Recommended Posts

Hi All,

I'm trying to get customer details and shipping address after the orders are processed from selective carts. I've got the cart Id to start with. But I'm having difficulty retrieving the customer's first name, last, name and shipping address. I've tried the following so far.

$cart_id = $value['cart_id'];
$result = false;
$order = Order::getOrderByCartId((int)($cart_id));
$order_details = OrderDetail::getList((int)$order);
if(isset($order_details[0])) {
    $order_id = $order_details[0]['id_order'];
    $customer = new Customer ($order_id);
    if (!Validate::isLoadedObject($customer)) {
        print_r($customer);
    }
}

The above code is giving me the entire customer object. But I'm not sure how to get the firstname, lastname, address and email from it.

Appreciate you taking out time for this.

Regards

B

Share this post


Link to post
Share on other sites

I solved this. The following is my solution.

$cart_id = $value['cart_id'];
$result = false;
$order = Order::getOrderByCartId((int)($cart_id));
$order_details = new Order((int)($order));
$delivery_details = new Address((int)($order_details->id_address_delivery));
$customer = new Customer((int)($delivery_details->id_customer));
print_r($customer);
print_r($delivery_details);

I was able to get customer details like email etc with $customer and delivery details like firstname, lastname, phone, address, etc with $delivery_details

 

P.S : this thread can be closed (i think.) as long as nobody wants to add a new answer.

Regards

B

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More