Here is another how-to dealing with the way to add our custom registration field to the checkout process and pushing it to the customer account on order validation.
The hack is to add the "Flavour" field to the billing address step of the Onepage Checkout.
For this, we need to override the Sales module.
First, follow steps 1. and 2. but reading/using/writing "Sales" instead of "Customer"
Then, in app/local/.../Sales/etc/config.xml, around line 153 :
change
Please note that the goal of this how-to is to add a customer-account-wide "Flavour" field rather than an address-wide field (like a "mobile phone" field would be). So, once the "Flavour" field has been set at the customer's first order, it will not be available at checkout for further orders. This explains the use of "isLoggedIn()".
My favourite Ice Cream flavour is Ben & Jerry's chocolate and macadamia nuts!
Tested on Magento 1.4.0.1
Here is another how-to dealing with the way to add our custom registration field to the checkout process and pushing it to the customer account on order validation.
The hack is to add the "Flavour" field to the billing address step of the Onepage Checkout.
For this, we need to override the Sales module.
First, follow steps 1. and 2. but reading/using/writing "Sales" instead of "Customer"
Then, in app/local/.../Sales/etc/config.xml, around line 153 :
change
</sales_convert_quote_address>to
Then we need to modify the Sales/Model/Convert/Quote.php file (best practice is to override it in order not to lose our changes on core updates)
Modify the public function addressToOrder() (around line 66) like this :
At last, we need to add the "Flavour" field to the billing step of the One Step Checkout.
Add the following lines to your theme's checkout/onepage/billing.phtml file where you want the "Flavour" field to appear :
Please note that the goal of this how-to is to add a customer-account-wide "Flavour" field rather than an address-wide field (like a "mobile phone" field would be). So, once the "Flavour" field has been set at the customer's first order, it will not be available at checkout for further orders. This explains the use of "isLoggedIn()".
My favourite Ice Cream flavour is Ben & Jerry's chocolate and macadamia nuts!
Tested on Magento 1.4.0.1