4

One of customers contacted him to point out that he is not able to specify different billing and shipping addresses for his account. When he changes one address, the other automatically changes as well.

I logged into the Magento admin console to try and separate the addresses myself, but I didn’t find a way.

Any Idea!!!!

5

I couldn’t fix the problem so I ended up just displaying a message to users. It only shows the message when they have one address in their address book.

To implement this fix using the default Magento theme, insert the code below in app/design/frontend/your-interface/your-theme/template/customer/address/edit.phtml

<?php if($this->isDefaultBilling() && $this->isDefaultShipping()): ?>
<ul>
    <li class="error-msg">Editing this address will update both your billing and shipping address. If you want to add an entirely new billing or shipping address click <a href="<?php echo $this->getBaseUrl();?>customer/address/new/" title="Create New Billing or Shipping Address">here</a>.</li>
</ul>
<?php endif; ?>

it's working..

| improve this answer | |
2

I have also had customers complain about not being able to separately edit their billing and shipping addressees. This is due to what is rather non-intuitive behavior of Magento.

It appears to the customer that there are two addresses each with separate edit links. However, by default, there really is only one record being displayed twice! Editing either address actually edits same underlying record, resulting in the behavior customers complain about.

The work-around for customers is to 'Add' an address to their address book. Now they will have two address records that can be edited independently. They can also choose which address is default for billing and which is default for shipping.

There is definitely room for Magento improvement here! One simple approach might be to just display one address and indicate it is both the shipping and billing address. And then provide a button to create a separate shipping (or billing) address.

| improve this answer | |
2

Couldn't find a way to separate the addresses either, though I've been able to stop this problem from occurring with new registrations by creating two separate addresses for billing and shipping. Tried this only on 1.9.1.0. You have to override the Mage_Customer_AccountController and change the _getErrorsOnCustomerAddress method.

protected function _getErrorsOnCustomerAddress($customer)
{
    $errors = array();
    /* @var $address Mage_Customer_Model_Address */
    $address = $this->_getModel('customer/address');
    /* @var $addressForm Mage_Customer_Model_Form */
    $addressForm = $this->_getModel('customer/form');
    $addressForm->setFormCode('customer_register_address')
        ->setEntity($address);

    $addressData = $addressForm->extractData($this->getRequest(), 'address', false);
    $addressErrors = $addressForm->validateData($addressData);
    if (is_array($addressErrors)) {
        $errors = array_merge($errors, $addressErrors);
    }

    $address->setId(null)
        ->setIsDefaultBilling(1)
        ->setIsDefaultShipping(0);
    $addressForm->compactData($addressData);
    $customer->addAddress($address);

    $shipaddress = $this->_getModel('customer/address');
    /* @var $addressForm Mage_Customer_Model_Form */
    $shipaddressForm = $this->_getModel('customer/form');
    $shipaddressForm->setFormCode('customer_register_address')
    ->setEntity($shipaddress);

    $shipaddressData = $shipaddressForm->extractData($this->getRequest(), 'address', false);
    $shipaddressErrors = $shipaddressForm->validateData($shipaddressData);
    if (is_array($shipaddressErrors)) {
        $errors = array_merge($errors, $shipaddressErrors);
    }
    $shipaddress->setId(null)
    ->setIsDefaultBilling(0)
    ->setIsDefaultShipping(1);
    $shipaddressForm->compactData($shipaddressData);
    $customer->addAddress($shipaddress);

    $addressErrors = $address->validate();
    if (is_array($addressErrors)) {
        $errors = array_merge($errors, $addressErrors);
    }
    return $errors;
}
| improve this answer | |
0

Sort of super late, but what I did when facing this problem was add a variable to the generated link for the save url. so it was like

 domain/customer/address/edit/id/idnumber/?edittype=billing or ?edittype=shipping

then in php I overwrote the AddressController.php's

 formPostAction()

Method and basically copied it and added

$editType=Mage::app()->getRequest()->getParam('edittype');   
if($editType=='billing'){
                $address->setIsDefaultBilling(1);
                $address->setID(null);
            }else if($editType=='shipping'){
                $address->setIsDefaultShipping(1);
                $address->setId(null);
            }

Just make sure you do it before you hit the $address->validate() and it should save the old address, and assign this new one be default shipping or billing address based on what

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.