On checkout, I'd like the Billing section to load - by default - the last (saved) address that the customer checked out with by default, as opposed to the primary billing address.
I looked at app/design/frontend/base/default/template/checkout/onepage/billing.phtml
:
And established that this is the call I'll need to override:
<label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
<div class="input-box">
<?php echo $this->getAddressesHtmlSelect('billing') ?>
</div>
This method (getAddressesHtmlSelect('billin')
) is located in:
app/code/core/Mage/Checkout/Block/Onepage/Abstract.php
: (~line 110)
At about line 124, the $type
parameter is verified:
if ($type=='billing') {
$address = $this->getCustomer()->getPrimaryBillingAddress();
}
I'm trying to think of an intelligible method to, instead of loading the primary billing address, loading the last billing address which was used?
Or do you think the better approach would be saving the billing address used on checkout as the primary billing address?
I suppopse either method would work, but would appreciate some insight.
P.S. I couldn't find a setPrimaryBillingAddress
method anywhere in the code base.