1

I am currently using magento 1.9 I am using IWD's one page checkout extension version 4.0.5(latest). I want to add a custom drop down field to the IWD's checkout page e.g. Where did you here about us ? Customer must select one of the answers. The answer then should be saved to quote and order table. And also must be visible in the order info from the admin panel (sales->orders). I have managed to achieve the similar on magento's default checkout and it is working perfect for me. But now I want to add the similar field to IWD's checkout.

My default magento checkout : enter image description here My order : enter image description here

I want to achieve same for the extension's checkout page.

More than 10,000+ stores are using that extension. Someone must have been able to sort it out. Looking for good support. Thanks I am a beginner at magento though.

  • I have exactly the same problem... can somebody? – Zydol May 9 '18 at 14:20
  • Just go through my answer below :) – Ahsan Horani May 11 '18 at 7:57
4

Well, I have managed to sort it out. It was quite simple than I was expecting.

To add a custom field in IWD checkout page, go to app\design\frontend\base\default\template\opc then add your custom field in any phtml.

For e.g. I have included a select box on checkout page.

Then to capture this value

1) Create an observer for the event checkout_onepage_controller_success_action

2) Hook another event with same observer for checkout_controller_onepage_save_shipping_method

The reason for creating checkout_controller_onepage_save_shipping_method is on the extension's checkout page there is no event like save_order_place_before so when ever you load checkout page, set shipping,payment or even click place order, you can debug using FireBug that the checkout_controller_onepage_save_shipping_method event is fired before order placement.

So what I did is, in the observer method for the above event I captured the posted data.

e.g. $data = Mage::App()->getRequest()->getPost('yourCustomFieldName');

Then save $data into customer/session.

No come to the observer class method for the event checkout_onepage_controller_success_action. This is the event when your order has been placed. Now you can add any stuff into order table or anywhere you want.

You have your submitted data from front end. Just write your custom query in the observer to enter into DB. Similarly you can write queries to read from database also.

Hope this will be helpful for some of you. Although I am a beginner may be didn't explain properly.

Thank you.

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.