For orders checked out by a non-registered customer (i.e. guest), Magento doesn't create a customer. However, it does store the address information in sales_flat_order_address. How do you access this data? Under this table, there are columns like firstname, lastname, address_type (billing/shipping), etc. which are what I need.

I tried loading the order object (sales/order), thinking the associated table data would be available from this, but they don't seem to be. Since I can't get the entity_ids of sales_flat_order_address corresponding to an order in sales_flat_order, how would I get the shipping and billing address in this case? I am not able to load by the parent_id, which is the row ID of the main order table, either.

I can access sales_flat_order_payment data via ->getPayment(), but ->getAddress(es)() doesn't seem to work.

Any ideas?


Let's say that you have the order id 10000015: So

$orderId = '10000015';
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
$billingAddress = $order->getBillingAddress();
$shippingAddress = $order->getShippingAddress();
| improve this answer | |
  • I see it now in Order.php for the Sales model. Thanks! – musicliftsme Oct 21 '13 at 22:57
  • Correction: Sales module is what I meant! (Mage_Sales_Model_Order) – musicliftsme Mar 19 '14 at 13:41
  • @Marius I am using the above code and the log file captured is 5mb and it has all [customer_eav_attribute] ? can you guess whats the wrong? – Butterfly Aug 1 '15 at 11:12

Get shipping details by order id

$order_id = 2314; //use your own order id 

$order = Mage::getModel("sales/order")->load($order_id); //load order by order id 

$shipping_address = $order->getShippingAddress();

 echo $shipping_address->getTelephone(); 

echo $shipping_address->getPostcode(); //use print_r($shipping_address->getData()); to get all the available elements of the object
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.