Magento

Adding Custom Fields to Magento Checkout

We develop for a couple clients that use Magento as an eCommerce platform.  Magento is a very powerful piece of software; however, it can also be a little daunting.  We set out to add a “How did you hear about us?” field to the checkout so our client could see if their advertising was effective.  It turned out to be a little bit more complicated than we expected.  To get it to work required many Google searches and visits to different sites, so we thought we’d gather everything in one place for anyone else wanting add a “How did you hear about us?” field.

Step 1:  Install the Customer Order Comment Extension via Magento Connect
– To use Magento Connect, open the Magneto Admin panel and then go to System > Magento Connect > Magento Connect Manager.

Step 2:  Copy Customer Order Comment Files to Your Template
– Locate the sample file templates in /app/code/community/Biebersdorf/CustomerOrderComment/design/.
– Using the sample file templates as an example, edit the corresponding files in your template.  Note:  if you have not set up a custom template yet, you should do so as to avoid editing Magento core files.  For more info read  about Creating Themes in Magento.

Step 3:  Update the Display Text
– To change the text displayed above the text field, open the files in your template that you edited with the Customer Order Comment code and find this line:  <?php echo $this->helper(‘biebersdorfcustomerordercomment’)->__(‘How did you hear about us?’) ?>

Step 4:  Display Responses on Customers’ Orders
– If you are asking people for info, odds are you want to be able to see it yourself.
– To get responses to show on orders, take a look at the example template in /app/code/community/Biebersdorf/CustomerOrderComment/design/adminhtml.
– Update the corresponding files in your template with the Customer Order Comments code in the example template.

Step 5:  Test
– Turn off your Magento cache and test the checkout process.  You should see the “How did you hear about us?” text with a field below for entries.
– Put a phrase (like “Testing123”) into the field and complete the order.
– Go into the admin panel and view the test order, about halfway down the order page you should see a Customer Order Comments heading about halfway down the page with the test phrase you entered during the test order below it.
– Congratulations, you have successfully added the “How did you hear about us?” field!

Leave a Reply

Your email address will not be published. Required fields are marked *