I have the order object. From that I can get the shipping address id. Can anyone suggest how to derive Shipping address by shipping address id?
You could use the order_address object to get the shipping address:
$address = Mage::getModel('sales/order_address')->load($shippingId); // $shippingId is the id you get from order object. $custName = $address->getName(); $custAddr = $address->getStreetFull(); $region = $address->getRegion(); $country = $address->getCountry();
to see what are the methods that can be used on the address object ($address).
hope it solves your prob :)
To get the Address from an order object you could simple do
$order_id = 123; // put your order id here $order = Mage::getModel('sales/order')->load($order_id);
$address = $order->getShippingAddress(); $custName = $address->getName(); $custAddr = $address->getStreetFull(); $region = $address->getRegion(); $country = $address->getCountry();
Shathish has given you a nice and correct answer.
However, you can use the singleton method and a query:
$shimnetId = "1"; // use your shipment id: $read = Mage::getSingleton('core/resource')->getConnection('core_read'); $query = "SELECT * FROM sales_flat_order_address WHERE entity_id='".$shipmentId."'"; $results = $read->fetchAll($query); var_dump($results);
sales_flat_order_address contains both the billing and shipping address.
Hope it will work for you.