How can I load Billing address from sales_flat+order_address first then shipping after?
-
13-12-2019 - |
Question
I've been trying for hours to load the billing address from the sales_flat_order_address table then I would like to get the shipping address but for some reason the shipping loads first.
I'm using the parent_id to load the model and I'd expect the billing row to load first but it isn't. For some reason it skips over the billing address and loads the shipping data first then come back for the billing address after.
Does anyone know what I'm doing wrong here?
Solution
this is how you get the billing addess
$orderdata = Mage::getModel('sales/order')->load(212295);
$billingAddress = $orderdata->getBillingAddress();
$address=$billingAddress->getStreet();
echo $address[0];
OTHER TIPS
I am not sure but if you have order object then why you are not getting address from directly by order object.
$order = Mage::getModel('sales/order')->load($orderId);
$billingAddress = $order->getBillingAddress();
$shippingAddress = $order->getShippingAddress();
It will also give you billing and shipping address of order.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange