每当客户来到单页结帐页面时,我都需要重置报价的帐单地址。
所以我扩展了 OnepageController 的 indexAction() 方法并添加了以下行来创建一个新的报价地址对象并将其分配给报价对象。但是调试代码告诉我,我从报价中得到的地址仍然是旧地址。
...
Mage::getSingleton('checkout/session')->setCartWasUpdated(false);
Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_secure'=>true)));
$this->getOnepage()->initCheckout();
// --- Start of my code ------------------------------
// Create a new quote address object and pass it to the quote
$newBillingAddress = Mage::getModel('sales/quote_address');
$this->getOnepage()->getQuote()->setBillingAddress($newBillingAddress)->save();
// get address from quote to see whether is changed or not.
// but it is still the old address.
$billingAddress = $this->getOnepage()->getQuote()->getBillingAddress();
// --- End of my code ------------------------------
$this->loadLayout();
...