Has any one tried this contribution"How Did you Hear About Us v1.2"...it is great but I couldnt get it to work with osmax.
This is a discussion on How Did you Hear About Us v1.2---contribution within the osCmax v1.7 Discussion forums, part of the osCmax v1.7 Forums category; Has any one tried this contribution"How Did you Hear About Us v1.2"...it is great but I couldnt get it to ...
Has any one tried this contribution"How Did you Hear About Us v1.2"...it is great but I couldnt get it to work with osmax.
really curious to know if anyone installed this successfully. It is a great contribution.
Chao!
I'm looking in to this as well, i would love to have it run and it think it can but i'm not sure. i tried setting it up but i ran in to a large problem which in it did not let me see the 2 categories in the admin area ( i think due to the admin mod in max) and when creating a new client it was giving me an error of duplicated key in customer_info file (but it would save the client any how ??? lol.
Any how, any help on this mod would be super happy.
It should work although I am not familiar with this mod. You will have to manually install it and merge the code with max (using a program like kdiff3 or Beyond Compare).
Michael Sasek
osCMax Developer
osCmax installation service - Have our professionals install osCmax on your server - same day service!
osCmax 2.0 User Manual - the must have beginners guide to osCmax v2.0
Stay Up To Date with everything osCMax:
Free osCMax Newsletters - Security notices, New Releases, osCMax News
osCMax on Twitter - Up to the minute info as it happens. Know it first.
osCmax Documentation
Need help on this please. I almost have it working, and I'm sure it's something simple that i'm missing but i really could use this mod on my max cart and its almost working.
I was able to get everything working, i can see the new fields in the admin area, I can add and edit the referal sources and the report shows me the right amount of customers and everything. the only thing missing is that when I go to create a new customer it now gives me this error...
Also i checked my data base and it looks like it is populating the address book table, the customer table and the customer_info table just fine ??? =(1062 - Duplicate entry '90' for key 1
insert into customers_info (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('90', '0', now())
[TEP STOP]
These are the slq commands I used to setup the database
And these are the instructions i used to setup the files (with the changes i did personaly in bould to make it work in MAX...CREATE TABLE sources (
sources_id int NOT NULL auto_increment,
sources_name varchar(64) NOT NULL,
PRIMARY KEY (sources_id),
KEY IDX_SOURCES_NAME (sources_name)
);
INSERT INTO sources VALUES (1, 'Google');
INSERT INTO sources VALUES (2, 'Yahoo!');
INSERT INTO sources VALUES (3, 'AOL');
INSERT INTO sources VALUES (4, 'MSN');
INSERT INTO sources VALUES (5, 'osCommerce');
CREATE TABLE sources_other (
customers_id int NOT NULL,
sources_other_name varchar(64) NOT NULL,
PRIMARY KEY (customers_id)
);
ALTER TABLE customers_info ADD customers_info_source_id int NOT NULL AFTER customers_info_date_account_last_modified;
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Display "Other" Referral option', 'DISPLAY_REFERRAL_OTHER', 'true', 'Display "Other - please specify" with text box in referral source in account creation', '1', '22', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Display Referral options if "ref=###" is set', 'DISPLAY_REFERRAL_SOURCE', 'true', 'Display referral selection dropdown in referral source in account creation when "ref=###" is set', '1', '23', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Require Referral', 'REFERRAL_REQUIRED', 'true', 'Require the Referral Source in account creation', '5', '6', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now());
In catalog\create_account.php
Look for: (around line 54)
$password = tep_db_prepare_input($HTTP_POST_VARS['password']);
$confirmation = tep_db_prepare_input($HTTP_POST_VARS['confirmation']);
Add below:
//rmh referral start
$source = tep_db_prepare_input($HTTP_POST_VARS['source']);
if (isset($HTTP_POST_VARS['source_other'])) $source_other = tep_db_prepare_input($HTTP_POST_VARS['source_other']);
//rmh referral end
Look for: (around line 156)
if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
$error = true;
$messageStack->add('create_account', ENTRY_TELEPHONE_NUMBER_ERROR);
}
Add below:
//rmh referral start
if ((REFERRAL_REQUIRED == 'true') && (is_numeric($source) == false)) {
$error = true;
$messageStack->add('create_account', ENTRY_SOURCE_ERROR);
}
if ((REFERRAL_REQUIRED == 'true') && (DISPLAY_REFERRAL_OTHER == 'true') && ($source == '9999') && (!tep_not_null($source_other)) ) {
$error = true;
$messageStack->add('create_account', ENTRY_SOURCE_OTHER_ERROR);
}
//rmh referral end
Loof for: (around line 221)
tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
$address_id = tep_db_insert_id();
tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");
Add below:
//rmh referral start
tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created, customers_info_source_id) values ('" . (int)$customer_id . "', '0', now(), '". (int)$source . "')");
if ($source == '9999') {
tep_db_perform(TABLE_SOURCES_OTHER, array('customers_id' => (int)$customer_id, 'sources_other_name' => tep_db_input($source_other)));
}
//rmh referral end
Look for (around line 243)
tep_session_register('customer_default_address_id' );
tep_session_register('customer_country_id');
tep_session_register('customer_zone_id');
Add below:
tep_session_unregister('referral_id'); //rmh referral
Look for (around line 495): ******* THIS IS NOT FOUND HERE, I ADDED IT UNDER MY TEMPLATE UNDER THE CONTENT FOLDER **
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" cellspacing="2" cellpadding="2">
<tr>
<td class="main"><?php echo ENTRY_NEWSLETTER; ?></td>
<td class="main"><?php echo tep_draw_checkbox_field('newsletter', '1') . '&nbsp;' . (tep_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="inputRequirement">' . ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
Add below:
<!-- //rmh referral start -->
<?php
if ((tep_not_null(tep_get_sources()) || DISPLAY_REFERRAL_OTHER == 'true') && (!tep_session_is_registered('referral_id') || (tep_session_is_registered('referral_id') && DISPLAY_REFERRAL_SOURCE == 'true')) ) {
?>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td class="main"><b><?php echo CATEGORY_SOURCE; ?></b></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" cellspacing="2" cellpadding="2">
<tr>
<td class="main"><?php echo ENTRY_SOURCE; ?></td>
<td class="main"><?php echo tep_get_source_list('source', (DISPLAY_REFERRAL_OTHER == 'true' || (tep_session_is_registered('referral_id') && tep_not_null($referral_id)) ? true : false), (tep_session_is_registered('referral_id') && tep_not_null($referral_id)) ? '9999' : '') . '&nbsp;' . (tep_not_null(ENTRY_SOURCE_TEXT) ? '<span class="inputRequirement">' . ENTRY_SOURCE_TEXT . '</span>': ''); ?></td>
</tr>
<?php
if (DISPLAY_REFERRAL_OTHER == 'true' || (tep_session_is_registered('referral_id') && tep_not_null($referral_id))) {
?>
<tr>
<td class="main"><?php echo ENTRY_SOURCE_OTHER; ?></td>
<td class="main"><?php echo tep_draw_input_field('source_other', (tep_not_null($referral_id) ? $referral_id : '')) . '&nbsp;' . (tep_not_null(ENTRY_SOURCE_OTHER_TEXT) ? '<span class="inputRequirement">' . ENTRY_SOURCE_OTHER_TEXT . '</span>': ''); ?></td>
</tr>
<?php
}
?>
</table></td>
</tr>
</table></td>
</tr>
<?php
} else if (DISPLAY_REFERRAL_SOURCE == 'false') {
echo tep_draw_hidden_field('source', ((tep_session_is_registered('referral_id') && tep_not_null($referral_id)) ? '9999' : '')) . tep_draw_hidden_field('source_other', (tep_not_null($referral_id) ? $referral_id : ''));
}
?>
<!-- //rmh referral end -->
------------------###############---------------------
In catalog\login.php
Look for (around line 51):
tep_session_register('customer_first_name');
tep_session_register('customer_country_id');
tep_session_register('customer_zone_id');
Add below:
tep_session_unregister('referral_id'); //rmh referral
------------------###############---------------------
In catalog\includes\application_top.php
Look for (around 40:
case 'cust_order' : if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {
if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {
tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));
} else {
$cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);
}
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
break;
}
}
Add below:
//rmh referral start
// set the referral id
if (!tep_session_is_registered('referral_id') || isset($HTTP_GET_VARS['ref'])) {
if (!tep_session_is_registered('referral_id') && !tep_session_is_registered('customer_id')) {
tep_session_register('referral_id');
}
if (isset($HTTP_GET_VARS['ref']) && tep_not_null($HTTP_GET_VARS['ref'])) {
$referral_id = $HTTP_GET_VARS['ref'];
} else {
$referral_id = '';
}
}
//rmh referral end
------------------###############---------------------
In catalog\includes\database_tables.php
Add:
define('TABLE_SOURCES', 'sources');//rmh referral
define('TABLE_SOURCES_OTHER', 'sources_other');//rmh referral
------------------###############---------------------
In catalog\includes\functions\general.php
At the bottom of file, add before the ?> ADD:
////rmh referral
// Returns an array with sources
// TABLES: sources
function tep_get_sources($sources_id = '') {
$sources_array = array();
if (tep_not_null($sources_id)) {
$sources = tep_db_query("select sources_name from " . TABLE_SOURCES . " where sources_id = '" . (int)$sources_id . "'");
$sources_values = tep_db_fetch_array($sources);
$sources_array = array('sources_name' => $sources_values['sources_name']);
} else {
$sources = tep_db_query("select sources_id, sources_name from " . TABLE_SOURCES . " order by sources_name");
while ($sources_values = tep_db_fetch_array($sources)) {
$sources_array[] = array('sources_id' => $sources_values['sources_id'],
'sources_name' => $sources_values['sources_name']);
}
}
return $sources_array;
}
------------------###############---------------------
In catalog\includes\functions\html_ouput.php
At the bottom of file, add before the ?> ADD:
////rmh referral
// Creates a pull-down list of sources
function tep_get_source_list($name, $show_other = false, $selected = '', $parameters = '') {
$sources_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
$sources = tep_get_sources();
for ($i=0, $n=sizeof($sources); $i<$n; $i++) {
$sources_array[] = array('id' => $sources[$i]['sources_id'], 'text' => $sources[$i]['sources_name']);
}
if ($show_other == 'true') {
$sources_array[] = array('id' => '9999', 'text' => PULL_DOWN_OTHER);
}
return tep_draw_pull_down_menu($name, $sources_array, $selected, $parameters);
}
------------------###############---------------------
In catalog\includes\languages\english.php
Look for:
// pull down default text
define('PULL_DOWN_DEFAULT', 'Please Select');
define('TYPE_BELOW', 'Type Below');
Add below:
define('PULL_DOWN_OTHER', 'Other - (please specifiy)'); //rmh referral
Look for:
define('CATEGORY_ADDRESS', 'Your Address');
define('CATEGORY_CONTACT', 'Your Contact Information');
define('CATEGORY_OPTIONS', 'Options');
Add below:
define('CATEGORY_SOURCE', 'Referral Source'); //rmh referral
Look for:
define('ENTRY_PASSWORD_CURRENT_ERROR', 'Your Password must contain a minimum of ' . ENTRY_PASSWORD_MIN_LENGTH . ' characters.');
define('ENTRY_PASSWORD_NEW', 'New Password:');
define('ENTRY_PASSWORD_NEW_TEXT', '*');
define('ENTRY_PASSWORD_NEW_ERROR', 'Your new Password must contain a minimum of ' . ENTRY_PASSWORD_MIN_LENGTH . ' characters.');
define('ENTRY_PASSWORD_NEW_ERROR_NOT_MATCHING', 'The Password Confirmation must match your new Password.');
define('PASSWORD_HIDDEN', '--HIDDEN--');
Add below:
//rmh referral begin
define('ENTRY_SOURCE', 'How did you hear about us:');
define('ENTRY_SOURCE_ERROR', 'Please select how you first heard about us.');
define('ENTRY_SOURCE_OTHER', '(if "Other" please specify)');
define('ENTRY_SOURCE_OTHER_ERROR', 'Please enter how you first heard about us.');
if (REFERRAL_REQUIRED == 'true') {
define('ENTRY_SOURCE_TEXT', '*');
define('ENTRY_SOURCE_OTHER_TEXT', '*');
} else {
define('ENTRY_SOURCE_TEXT', '');
define('ENTRY_SOURCE_OTHER_TEXT', '');
}
//rmh referral end
------------------###############---------------------
In catalog\admin\customers.php
Look for (around line 704):
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="dataTableHeadingRow">
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_LASTNAME; ?></td>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_FIRSTNAME; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACCOUNT_CREATED; ?></td>
Add below:
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_REFERRED_BY; //rmh referral ?></td>
Look for (around line 740):
if (isset($cInfo) && is_object($cInfo) && ($customers['customers_id'] == $cInfo->customers_id)) {
echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=edit') . '\'">' . "\n";
} else {
echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID')) . 'cID=' . $customers['customers_id']) . '\'">' . "\n";
}
Add below:
//rmh referral start
$source_query = tep_db_query("select customers_info_source_id from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customers['customers_id'] . "'");
$source = tep_db_fetch_array($source_query);
$entry_referral = tep_get_sources_name($source['customers_info_source_id'], $customers['customers_id']);
//rmh referral end
Right after that you should see:
?>
<td class="dataTableContent"><?php echo $customers['customers_lastname']; ?></td>
<td class="dataTableContent"><?php echo $customers['customers_firstname']; ?></td>
<td class="dataTableContent" align="right"><?php echo tep_date_short($info['date_account_created']); ?></td>
Add this after:
<td class="dataTableContent" align="right"><?php echo $entry_referral; //rmh referral ?></td>
------------------###############---------------------
In catalog\admin\includes\database_tables.php
Add:
define('TABLE_SOURCES', 'sources'); //rmh referrals
define('TABLE_SOURCES_OTHER', 'sources_other'); //rmh referrals
------------------###############---------------------
In catalog\admin\includes\filenames.php
Add:
define('FILENAME_REFERRALS', 'referrals.php'); //rmh referrals
define('FILENAME_STATS_REFERRAL_SOURCES', 'stats_referral_sources.php'); //rmh referrals
------------------###############---------------------
In catalog\admin\includes\boxes\customers.php **** SEE BELOW FOR HOW I SETUP MY FILES SINCE IN MAX THERE IS AN ADMIN MODULE ***
Look for:
if ($selected_box == 'customers') {
$contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CUSTOMERS_CUSTOMERS . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_ORDERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CUSTOMERS_ORDERS . '</a>');
}
Replace with:
if ($selected_box == 'customers') {
$contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CUSTOMERS_CUSTOMERS . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_ORDERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CUSTOMERS_ORDERS . '</a><br>' . //rmh referrals
'<a href="' . tep_href_link(FILENAME_REFERRALS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CUSTOMERS_REFERRALS . '</a>'); //rmh referrals
}
***** THIS IS HOW I HAVE THIS FILE SETUP (I ALSO WHENT IN TO THE ADMIN AREA AND ENABLED THIS CUSTOMER.php and it comes up perfectly under the admin area ****
<!-- customers //-->
<tr>
<td>
<?php
$heading = array();
$contents = array();
$heading[] = array('text' => BOX_HEADING_CUSTOMERS,
'link' => tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers'));
if ($selected_box == 'customers') {
$contents[] = array('text' =>
//Admin begin
// '<a href="' . tep_href_link(FILENAME_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CUSTOMERS_CUSTOMERS . '</a><br>' .
// '<a href="' . tep_href_link(FILENAME_ORDERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CUSTOMERS_ORDERS . '</a><br>' . //rmh referrals
// '<a href="' . tep_href_link(FILENAME_REFERRALS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CUSTOMERS_REFERRALS . '</a>'); //rmh referrals
tep_admin_files_boxes(FILENAME_CUSTOMERS, BOX_CUSTOMERS_CUSTOMERS) .
tep_admin_files_boxes(FILENAME_ORDERS, BOX_CUSTOMERS_ORDERS) .
tep_admin_files_boxes(FILENAME_REFERRALS, BOX_CUSTOMERS_REFERRALS) .
tep_admin_files_boxes(FILENAME_PAYPAL_IPN, BOX_CUSTOMERS_PAYPAL_IPN));
//Admin end
}
$box = new box;
echo $box->menuBox($heading, $contents);
?>
</td>
</tr>
<!-- customers_eof //-->
------------------###############---------------------
In catalog\admin\includes\boxes\reports.php **** SEE BELOW FOR HOW I SETUP MY FILES SINCE IN MAX THERE IS AN ADMIN MODULE ***
Look for:
if ($selected_box == 'reports') {
$contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_VIEWED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_VIEWED . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_PURCHASED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_PURCHASED . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a>');
}
And Replace with:
if ($selected_box == 'reports') {
$contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_VIEWED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_VIEWED . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_PURCHASED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_PURCHASED . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_STATS_REFERRAL_SOURCES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_REFERRAL_SOURCES . '</a><br>' . //rmh referrals
'<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a>');
}
***** THIS IS HOW I HAVE THIS FILE SETUP (I ALSO WHENT IN TO THE ADMIN AREA AND ENABLED THIS REPORT.php and it comes up perfectly under the admin area ****
<!-- reports //-->
<tr>
<td>
<?php
$heading = array();
$contents = array();
$heading[] = array('text' => BOX_HEADING_REPORTS,
'link' => tep_href_link(FILENAME_STATS_PRODUCTS_VIEWED, 'selected_box=reports'));
if ($selected_box == 'reports') {
$contents[] = array('text' =>
//Admin begin
// '<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_VIEWED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_VIEWED . '</a><br>' .
// '<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_PURCHASED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_PURCHASED . '</a><br>' .
// '<a href="' . tep_href_link(FILENAME_STATS_REFERRAL_SOURCES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_REFERRAL_SOURCES . '</a><br>' . //rmh referrals
// '<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a>');
tep_admin_files_boxes(FILENAME_STATS_PRODUCTS_VIEW ED, BOX_REPORTS_PRODUCTS_VIEWED) .
tep_admin_files_boxes(FILENAME_STATS_PRODUCTS_PURC HASED, BOX_REPORTS_PRODUCTS_PURCHASED) .
tep_admin_files_boxes(FILENAME_STATS_REFERRAL_SOUR CES, BOX_REPORTS_REFERRAL_SOURCES) .
tep_admin_files_boxes(FILENAME_STATS_CUSTOMERS, BOX_REPORTS_ORDERS_TOTAL));
//Admin end
}
$box = new box;
echo $box->menuBox($heading, $contents);
?>
</td>
</tr>
<!-- reports_eof //-->
------------------###############---------------------
In catalog\admin\includes\functions\general.php
Add this at the bottom before ?>:
// rmh referral
function tep_get_sources_name($source_id, $customers_id) {
if ($source_id == '9999') {
$sources_query = tep_db_query("select sources_other_name as sources_name from " . TABLE_SOURCES_OTHER . " where customers_id = '" . (int)$customers_id . "'");
} else {
$sources_query = tep_db_query("select sources_name from " . TABLE_SOURCES . " where sources_id = '" . (int)$source_id . "'");
}
if (!tep_db_num_rows($sources_query)) {
if ($source_id == '9999') {
return TEXT_OTHER;
} else {
return TEXT_NONE;
}
} else {
$sources = tep_db_fetch_array($sources_query);
return $sources['sources_name'];
}
}
------------------###############---------------------
In catalog\admin\includes\languages\english.php
Add this to: // customers box text in includes/boxes/customers.php
define('BOX_CUSTOMERS_REFERRALS', 'Referrals'); //rmh referrals
Add this to: // reports box text in includes/boxes/reports.php
define('BOX_REPORTS_REFERRAL_SOURCES', 'Referral Sources'); //rmh referrals
Add this to: // constants for use in tep_prev_next_display function
define('TEXT_DISPLAY_NUMBER_OF_REFERRALS', 'Displaying <b>%d</b> to <b>%d</b> (of <b>%d</b> referral sources)'); //rmh referrals
------------------###############---------------------
In catalog\admin\includes\languages\english\customers .php
Add:
define('TABLE_HEADING_REFERRED_BY', 'Referred By'); //rmh referral
I tried re-installing the mod, i'm getting stuck at the very same place : ( help please .
I think i have the problem almost licked, ok so i've been stressing over the code (i dont really know php at all) but based on the error it just seamed that the client was getting added twice, so i took out this
And now when a client goes to create an account the acount is created perfectly. Meaning that that bit of code above has one small error in it.//rmh referral end
Loof for: (around line 221)
tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
$address_id = tep_db_insert_id();
tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");
Add below:
//rmh referral start
tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created, customers_info_source_id) values ('" . (int)$customer_id . "', '0', now(), '". (int)$source . "')");
if ($source == '9999') {
tep_db_perform(TABLE_SOURCES_OTHER, array('customers_id' => (int)$customer_id, 'sources_other_name' => tep_db_input($source_other)));
}
//rmh referral end
If any one could look it over and say what it might be ? because by taking that code out now my refferals are not saving any more (but they where before even if the account creation screen gave an error).
No more help needed, thanks a tun for all the help guys, i was able to figure out the problem, it was infact in the customer file. Reall simple fix,
I will be posting the new max install instructions and files up here as a oscom max mod soon![]()
Bookmarks