Answers:
您可以使用order_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();
或使用
print_r(get_class_methods($address));
查看可以在地址对象($ address)上使用的方法。
希望它能解决您的问题:)
要从订单对象获取地址,您可以简单地执行 $order->getShippingAddress()
假设
$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();
$address
使用$address = $order->getShippingAddress()
时为空,但使用时$address = Mage::getModel('sales/order_address')->load($shippingId);
返回地址
Shathish给了您一个不错且正确的答案。
但是,您可以使用单例方法和查询:
$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
包含帐单地址和送货地址。
希望它对您有用。