Zen Cart How did you Hear About Us? Mod for version 1.3.8
Using the how did you hear about us mod from zen cart, I came across a few minor glitches that I had to fix.
Problem: When it was installed ( which was flawless ) the admin section showed all of the referral stuff. But when i came time for new user submissions, the information was not getting put in the database.
Solution: Turns out that this is a common problem. You have to make sure that you are not using a template overrided create_account.php. I was. SO I edited all three of the create_account.php files to be the same with the rmh code.
Next Problem: When the user clicked submit , and error was being created about a duplicate key and not continuing on with the user creation. Bad news.
Solution: I had to change the code to be an update to the customers_info table from an insert which was original to the rmh code.
find this block of code and make the changes below. Notice the # comments. These lines had to be commented out. The // comments are original.
//rmh referral start
# $query_insert= “insert into ” . TABLE_CUSTOMERS_INFO . ” (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created, customers_info_source_id) values (‘” . (int)$_SESSION['customer_id'] . “‘, ‘0′, now(), ‘”. (int)$source . “‘)”;
# $db->Execute($query_insert);
// BEGIN NEW CODE
$query_update = “update ” . TABLE_CUSTOMERS_INFO . ”
set customers_info_source_id = ‘” . (int)$source . “‘
where customers_info_id = ‘” . (int)$_SESSION['customer_id'] . “‘”;
$db->Execute($query_update);
// END NEW CODE
# $db->Execute($sql);
if ($source == ‘9999′) {
zen_db_perform(TABLE_SOURCES_OTHER, array(‘customers_id’ => (int)$_SESSION['customer_id'], ’sources_other_name’ => $source_other));
}
// $sql = “insert into ” . TABLE_CUSTOMERS_INFO . ”
// (customers_info_id, customers_info_number_of_logons,
// customers_info_date_account_created)
// values (‘” . (int)$_SESSION['customer_id'] . “‘, ‘0′, now())”;
//
// $db->Execute($sql);
//rmh referral end
Yeehaw. It works on account creation.
Problem: Now it works with actual user account creation. and the referral shows up in /admin/customers.php , but I also use the Checkout With Out Account mod. And wanted the referrals to be set in there as well.
Solution: Edit the no_account.php and place the rmh referral code in the same spots as the create_account.php. Noting the updated code that I wrote.
Now I have referrals being captured from both full account holders, and also the COWOA customers.
Now if only I could figure out how to get this info from my paypal customers…