0

I need to add new customer field. This field should be available during customer registration via OPC. How I can do it? I can rewrite Mage_Checkout_Model_Type_Onepage modify method saveBilling and add into it:

$this->getCheckout()->setSomeField($data['some_field']);

After it I can call Observer on event checkout_type_onepage_save_order and use such code:

$quote = $observer->getEvent()->getQuote();
$customer = $quote->getCustomer();
$customer->setSomeField(Mage::getSingleton('checkout/session')->getSomeField());

And this field will be added to customer.

But I already have 2 time rewrites for class Mage_Checkout_Model_Type_Onepage. And this one will be third. I don't like. Maybe I can use some event for it? Or any other approach?

3
  • in which step do you exactly want this field to be? Should Customer fill this field, or you'll pass any intrinsic value in it?
    – Shathish
    Commented Jul 18, 2013 at 7:52
  • It should be on Billing Step, when customer registration is possible, one more field for customer. Yes, customer should fill it. Commented Jul 18, 2013 at 8:02
  • Yes, it's possible. Check this post: magento.stackexchange.com/questions/6018/… Commented Jul 25, 2013 at 8:02

1 Answer 1

1

For adding a custom filed in billing step of customer registration, this might help you. For basic creation of custom customer attribute, refer this link. This process has a considerable amount of coding and that's why I'm providing the link.

And yo! you don't need to override Mage_Checkout_Model_Type_Onepage :)

2
  • Oh no, it's too long. I can save needed attribute at checkout/session and extract it on order save. This approach much simpler. Commented Jul 18, 2013 at 11:38
  • If you're looking for a quick and simple approach, you can carry on, but note that, that's not the perfect way to do it. Anyway all the best.
    – Shathish
    Commented Jul 18, 2013 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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