顧客が1ページのチェックアウトページにアクセスするたびに、見積もりの請求先住所をリセットする必要があります。
そこで、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();
...