Page 1 of 1

Add a field (select/dropdown) to one page checkout

Posted: Thu Feb 02, 2012 2:37 pm
by digdesigner
What is the code to add a select field or dropdown to the One Page Checkout? Ideally, we would want a select field on the first panel of the One Page Checkout, and this field would dump whatever the user selected into the admin somewhere. Help would be greatly appreciated.

Re: Add a field (select/dropdown) to one page checkout

Posted: Fri Feb 03, 2012 8:49 am
by jmestep
It's hard to add one on the first panel because that part is hidden when the payment forms come up and the selection is lost. I have done it by saving the selection to usersetting field and then changing it to an order customfield on the receipt page. Whenever I run into something like this, that is what I do because of hours spent in the past trying to do something like that on the checkout page. I learned to quit trying to fight the page and just do a work around.

Re: Add a field (select/dropdown) to one page checkout

Posted: Fri Feb 03, 2012 2:18 pm
by sloDavid
digdesigner, just so you know, this is not any kind of quick simple thing that you ask. It involves a lot of custom programming that you need to be prepared for. The general steps are as follows...

(Btw, If you're not already familiar with doing these things from other projects, I highly recommend that you not attempt to do this on your own. Find an ASP.NET developer that you can work with.)

First, you'll need to have the info related to the order somewhere, which means that you need to add a field to the orders table in the database. Personally, I don't like to edit the AC tables, so I create my own custom tables that are related to the existing tables, but that's not strictly necessary. I recommend at LEAST creating a prefix for the field unique to you that AC would never use, such as "dd_", so you could call your info field "dd_info", and set the datatype to be nvarchar(max) field.

Second, you need to determine where in the admin panel you're going to view/manage this info. Probably on the View Order page, so then you'll need to update that page to display the info out of the database.

Once all that's prepared, then and only then can you update the Checkout to receive this info from the user and store it. That is definitely a customization to the ConLib\OnePageCheckout.ascx user control. You need to customize one of the appropriate event handlers to read your DropDownList and update the database.

I also highly recommend that you program this in a way such that future updates from AbleCommerce don't overwrite it, and so that you can tell if something's changed. I manage all of my customizations by creating customized copies of the ConLib controls, and using my customized controls, instead of the default ones, from the Scriptlets.