Magento的.如何在报价中获取地址

Der*_*153 2 magento

我试着获取地址,客户在结账时选择地址步骤.

我在/app/code/local/Mandarin/AddressTypeDiscount/Block/Onepage/Review.php中使用此代码:

$checkout = Mage::getSingleton('checkout/session')->getQuote();
$bilAddress = $checkout->getBillingAddress();
$mylog = print_r($bilAddress, true);
Mage::log("addres:".$mylog, null, 'mygento.log');
Run Code Online (Sandbox Code Playgroud)

但在我的日志文件中,我得到了所有客户地址的数组.

我如何在地址步骤中获取所选地址?谢谢.

Ren*_*art 10

您的代码似乎是正确的,请参阅Magento中一页结帐的订单审核部分中的获取结算信息.

print_r($bilAddress, true) 将打印整个对象,而不是尝试 $bilAddress->getData()

尝试

 $checkout = Mage::getSingleton('checkout/session')->getQuote();
 $billAddress = $checkout->getBillingAddress();

 Mage::log($billAddress->getData());
Run Code Online (Sandbox Code Playgroud)