Adding referral survey data to database

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
mouse_8b
Commander (CMDR)
Commander (CMDR)
Posts: 115
Joined: Mon Oct 11, 2010 1:21 pm
Location: Austin, TX
Contact:

Adding referral survey data to database

Post by mouse_8b » Fri May 06, 2011 12:58 pm

Hello,
My company has made a big marketing push recently and we would like to know what is and isn't working. We figured putting a "Where did you find us" question on the checkout page would be a pretty good metric. However, I'm not exactly sure how to make it work correctly.

Things I know need to be done:
  • Create a table in the database to record answers
    Put an ASP select box on OPC
    Modify .cs file to record survey data to database
To create the table, I figure I just need to make an aspx page that will run this SQL code, but I don't know what C# methods to send this query to:

Code: Select all

CREATE TABLE SurveyData{
	NoAnswer int,	LongTimeCust int,	SearchEngine int,	GoogleAd int,	TV int,	Radio int,	Newspaper int,	Friend int}
This is my select box to go in OnePageCheckout.aspx. Am I right in thinking this (plus a prompt) is all that needs to be added OPC.aspx?

Code: Select all

<select id="selSurvey" runat="server">
	<option value="No">No Answer</option>
	<option value="LongTime">I am a long time customer</option>
	<option value="Search">Search Engine</option>
	<option value="GoogleAd">Google Ad</option>
	<option value="TV">TV Commercial</option>
	<option value="Radio">Radio Commercial</option>
	<option value="Newspaper">Newspaper Ad</option>
	<option value="Friend">From a Friend</option>
</select>
In OnePageCheckout.aspx.cs, I think I need to add to the CheckedOut() method. I know that "selSurvey.Value" is the data I'm looking for and I can use a switch statement to figure out which database entry to increment, but I don't know how to write that to the database.

I have some experience with using PHP to query mySQl databases, but no experience with using .NET languages to query MSSQL databases.

Am I on the right track? Is there a better way to do this? It looks like AC or .NET has some methods that make database access easier, but I'm not sure how to use them. Any help is appreciated.

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Adding referral survey data to database

Post by jmestep » Mon May 09, 2011 8:06 am

We have done it without a new table by creating an entry in the ac_CustomFields table with the orderid being the key to match on.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

Post Reply