i have a customer attribute with id: mobile, which is a required field in account creation. i want an observer to copy mobile attribute value into Magento default _address_telephone attribute automatically on account creation.

how should its observer.php and config.xml be?

I did it for product attribute this way: How to copy a product's attributes value to another attribute?

  • Did you try out Jeroen's solution? It should work – Sander Mangel Jun 27 '15 at 13:32

Your observer should have a function

public function moveMobileTo($observer) {
    $customer = $observer->getCustomer();

    // If you mean this, the next line applies
    $customer->setData('_address_telephone', $customer->getData('mobile'));

    // If you mean this, the next line applies
    $address = $customer->getPrimaryBillingAddress();
    $address->setData('telephone', $customer->getData('mobile'));

You should listen to the customer_save_before event.


<?xml version="1.0"?>
| 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.