Created
June 17, 2015 10:00
-
-
Save ivanweiler/1abf3e208129e699f76f to your computer and use it in GitHub Desktop.
Magento Checkout - fill address forms from Quote address (if possible) for guest customers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Mage_Checkout_Block_Onepage_Billing::getAddress() should be something like this | |
* | |
* Similar for Mage_Checkout_Block_Onepage_Shipping | |
*/ | |
public function getAddress() | |
{ | |
if (is_null($this->_address)) { | |
$this->_address = $this->getQuote()->getBillingAddress(); //always take address from quote | |
if ($this->isCustomerLoggedIn()) { | |
if(!$this->_address->getFirstname()) { | |
$this->_address->setFirstname($this->getQuote()->getCustomer()->getFirstname()); | |
} | |
if(!$this->_address->getLastname()) { | |
$this->_address->setLastname($this->getQuote()->getCustomer()->getLastname()); | |
} | |
} | |
} | |
return $this->_address; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment