Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How Did You Hear About Us - Support


Recommended Posts

Hi,

 

Great contribution thanks and working perfectly except that in the customers page of admin I get the following at the top of the table:

 

td class="dataTableHeadingContent" align="right">Referred By

 

 

Also in customers/referrals I get the following heading:

 

HEADING_TITLE

 

And the table headings are "TABLE_HEADING_REFERRALS" and "TABLE_HEADING_ACTION "

 

Any ideas on how to fix this, I have hunted through the code and can't find it, but then I am a relative newby.

 

Any help much appreciated.

 

Paul.

Link to comment
Share on other sites

  • 3 weeks later...
  • Replies 318
  • Created
  • Last Reply

Top Posters In This Topic

this is to display it on the admin/orders.php page, it works on my shop but somebody needs to test it to see if it works for them too, as i have a heavily modded admin panel. :)

 

beneath:

<tr>
<td class="main"><b><?php echo ENTRY_EMAIL_ADDRESS; ?></b></td>
<td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '">' . $order->customer['email_address'] . '</a>'; ?></td>
</tr>

 

add:

<tr>
<td class="main"><b>Entered Referral:</b></td>
<td class="main">
<?php
//rmh referral start
$cust_id_query = tep_db_query("select customers_id from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$cID . "'");
$cust_id = tep_db_fetch_array($cust_id_query);
  $source_query = tep_db_query("select customers_info_source_id  from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$cID . "'");
  $source = tep_db_fetch_array($source_query);

  $entry_referral = tep_get_sources_name($source['customers_info_source_id'], $cust_id['customers_id']);
echo $entry_referral;
//rmh referral end
?>
</td>
</tr>

Link to comment
Share on other sites

it says that for me too if the user didn't type anything or use the pull down menu. what about somebody that has a referral?

 

check this by going to admin -> customers and scroll down the list until you see something other than none, then go to view one of their orders and see the result?

Link to comment
Share on other sites

:rolleyes: stupid me, i did all of my testing by going through admin -> customers -> (click on customer with referral) -> click orders -> click details

 

this of course passes cID automatically :lol:

 

 

now when you try to test by going through admin -> (click a status) -> select a customer -> details... it said --none-- for all.

 

 

i do believe this should work properly now (replace the code i previously gave you) with this:

<tr>
<td class="main"><b>Entered Referral:</b></td>
<td class="main">
<?php
//rmh referral start
$cust_id_query = tep_db_query("select customers_name, customers_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
$cust_result = tep_db_fetch_array($cust_id_query);
$cID = $cust_result['customers_id'];
  $source_query = tep_db_query("select customers_info_source_id  from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$cID . "'");
  $source = tep_db_fetch_array($source_query);

  $entry_referral = tep_get_sources_name($source['customers_info_source_id'], $cust_id['customers_id']);
echo $entry_referral;
//rmh referral end
?>
</td>
</tr>

Link to comment
Share on other sites

whoops

ignore my last post

 

 

use this instead:

<tr>
<td class="main"><b>Entered Referral:</b></td>
<td class="main">
<?php
//rmh referral start
$cust_id_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
$cust_result = tep_db_fetch_array($cust_id_query);
$cID = $cust_result['customers_id'];
  $source_query = tep_db_query("select customers_info_source_id  from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$cID . "'");
  $source = tep_db_fetch_array($source_query);

  $entry_referral = tep_get_sources_name($source['customers_info_source_id'], $cust_result['customers_id']);
echo $entry_referral;
//rmh referral end
?>
</td>
</tr>

Link to comment
Share on other sites

  • 2 weeks later...

Hi

this question has been asked before but no answer....

 

when using Purchase Without Account the following code has been added to order_info_check.php

 

 <!-- //rmh referral start -->
<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' ? true : false)) . ' ' . (tep_not_null(ENTRY_SOURCE_TEXT) ? '<span class="inputRequirement">' . ENTRY_SOURCE_TEXT . '</span>': ''); 
if ($entry_source_error) {
  echo '  ' . ENTRY_SOURCE_ERROR;
} 
 ?></td>
		</tr>
<?php
if (DISPLAY_REFERRAL_OTHER == 'true') {
?>
		<tr>
		  <td class="main"><?php echo ENTRY_SOURCE_OTHER; ?></td>
		  <td class="main"><?php echo tep_draw_input_field('source_other') . ' ' . (tep_not_null(ENTRY_SOURCE_OTHER_TEXT) ? '<span class="inputRequirement">' . ENTRY_SOURCE_OTHER_TEXT . '</span>': ''); 
if ($entry_source_other_error) {
  echo '  ' . ENTRY_SOURCE_OTHER_ERROR;
} 

 ?></td>
		</tr>
<?php
}
?>
	  </table></td>
	</tr>
  </table></td>
</tr>


<!-- //rmh referral end -->

 

displays perfectly, but it doesnt enter the information into the database

 

If you look at the code above, it doesnt shown any database details

 

 

how can i get the referrer to be entered into the database like it does with account creation

thanks

ronnie

Link to comment
Share on other sites

  • 2 weeks later...

Just installed, and it appears to be working correctly.

 

However, when I look at the quantity of referrals, I have one for google (i selected via a test account)

 

And I have 367 for "other".. and the detail for other is blank. Is this because I installed this contribution after I've had several hundred accounts already created, so it's counting them as "other" but blank?

 

Great contribution, BTW.

Link to comment
Share on other sites

  • 2 weeks later...

Update posted, jsut some of my tweeks for the reports and a little code on how to disable the drop down if you want only a text box on create account.

 

 

Enjoy! :thumbsup:

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

Ive just installed 1.5

 

Im getting on the main site

 

Warning: session_save_path(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/phil/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/phil/public_html/msdiscreet/includes/functions/sessions.php on line 148

 

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/phil/public_html/msdiscreet/includes/functions/sessions.php:148) in /home/phil/public_html/msdiscreet/includes/functions/sessions.php on line 97

 

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/phil/public_html/msdiscreet/includes/functions/sessions.php:148) in /home/phil/public_html/msdiscreet/includes/functions/sessions.php on line 97

 

and this within the admin

 

Warning: session_save_path(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/phil/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/phil/public_html/msdiscreet/admin/includes/functions/sessions.php on line 110

 

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/phil/public_html/msdiscreet/admin/includes/functions/sessions.php:110) in /home/phil/public_html/msdiscreet/admin/includes/functions/sessions.php on line 67

 

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/phil/public_html/msdiscreet/admin/includes/functions/sessions.php:110) in /home/phil/public_html/msdiscreet/admin/includes/functions/sessions.php on line 67

 

Warning: Cannot modify header information - headers already sent by (output started at /home/phil/public_html/msdiscreet/admin/includes/functions/sessions.php:110) in /home/phil/public_html/msdiscreet/admin/includes/functions/general.php on line 114

 

 

Any ideas

Link to comment
Share on other sites

I manually checked all the files again. still happened but found the problem, even though my sessions should be stored in mysql...

 

For anyone with the same problem:

 

It's in table: configuration

 

Session Directory SESSION_WRITE_DIRECTORY /tmp

 

Simply change /tmp to tmp

Link to comment
Share on other sites

Hi

this question has been asked before but no answer....

 

when using Purchase Without Account the following code has been added to order_info_check.php

 

 <!-- //rmh referral start -->
<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' ? true : false)) . ' ' . (tep_not_null(ENTRY_SOURCE_TEXT) ? '<span class="inputRequirement">' . ENTRY_SOURCE_TEXT . '</span>': ''); 
if ($entry_source_error) {
  echo '  ' . ENTRY_SOURCE_ERROR;
} 
 ?></td>
		</tr>
<?php
if (DISPLAY_REFERRAL_OTHER == 'true') {
?>
		<tr>
		  <td class="main"><?php echo ENTRY_SOURCE_OTHER; ?></td>
		  <td class="main"><?php echo tep_draw_input_field('source_other') . ' ' . (tep_not_null(ENTRY_SOURCE_OTHER_TEXT) ? '<span class="inputRequirement">' . ENTRY_SOURCE_OTHER_TEXT . '</span>': ''); 
if ($entry_source_other_error) {
  echo '  ' . ENTRY_SOURCE_OTHER_ERROR;
} 

 ?></td>
		</tr>
<?php
}
?>
	  </table></td>
	</tr>
  </table></td>
</tr>


<!-- //rmh referral end -->

 

displays perfectly, but it doesnt enter the information into the database

 

If you look at the code above, it doesnt shown any database details

how can i get the referrer to be entered into the database like it does with account creation

thanks

ronnie

 

 

BUMP - Anyone Please

Link to comment
Share on other sites

  • 2 weeks later...
Hi

this question has been asked before but no answer....

 

when using Purchase Without Account the following code has been added to order_info_check.php

 

displays perfectly, but it doesnt enter the information into the database

 

If you look at the code above, it doesnt shown any database details

how can i get the referrer to be entered into the database like it does with account creation

thanks

ronnie

 

I have what maybe a silly ? but I have searched and searched for this file that you had mentioned order_info_check.php are you using ms1.

 

I am currently going through all of the PWA calls in create_account.php the trick is in there. I will try again tomarrow because its getting late.

 

Hopefully by then someone knows the answer but if not I give it a shot.

Link to comment
Share on other sites

hELLO i DOWNLOADED your contribution...I get an error under my Reports heading under Referral Sources:

 

please check:

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/serenity/serenityhd-www/admin/includes/functions/database.php:13) in /home/serenity/serenityhd-www/admin/includes/functions/database.php on line 13

 

thanks

Link to comment
Share on other sites

  • 1 month later...

this is how mine looks:

 

referral.jpg

 

 

my code for the table is:

 

lines 558-568:

<td class="<?php echo $class; ?>" align="middle"><?php echo $orders['orders_id']; ?></td>
			<td class="<?php echo $class; ?>"<?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $orders['orders_id'] . '&action=edit') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a> ' . $orders['customers_name']; ?></td>
			<td class="<?php echo $class; ?>" align="right"><?php echo strip_tags($orders['order_total']); ?></td>
			<td class="<?php echo $class; ?>" align="center"><?php echo tep_datetime_short($orders['date_purchased']); ?></td>
			<td class="<?php echo $class; ?>" align="right"><?php echo $orders['orders_status_name']; ?></td>
			<td class="<?php echo $class; ?>" align="right"><?php echo $entry_referral; ?></td>
			<td class="<?php echo $class; ?>" align="right"><?php if (isset($oInfo) && is_object($oInfo) && ($orders['orders_id'] == $oInfo->orders_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID')) . 'oID=' . $orders['orders_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
		  </tr>

 

 

lines 196-207 are:

<?php
//rmh referral start
$cust_id_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
$cust_result = tep_db_fetch_array($cust_id_query);
$cID = $cust_result['customers_id'];
$source_query = tep_db_query("select customers_info_source_id from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$cID . "'");
$source = tep_db_fetch_array($source_query);

$entry_referral = tep_get_sources_name($source['customers_info_source_id'], $cust_result['customers_id']);
echo $entry_referral;
//rmh referral end
?>

that code inserts the referral ID into the customers order detail page

Link to comment
Share on other sites

OH, so when you click on a status from admin/index.php (say, to see all "Pending" orders) you want to see the referral as well?

 

if that's correct, let me know and i'll take a stab at it when i return from lunch

Link to comment
Share on other sites

in the instructions readme.txt for v1.5 it says this:

 

In catalog\admin\customers.php

Look for (around line 214):
	tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customers_id . "'");
	tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customers_id . "'");
	tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customers_id . "'");
	tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customers_id . "'");
	tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customers_id . "'");
	tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . (int)$customers_id . "'");

Add below:
	tep_db_query("delete from " . TABLE_SOURCES_OTHER . " where customers_id = '" . (int)$customers_id . "'");

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>
------------------###############---------------------

 

I want this code to work for admin/orders.php

Link to comment
Share on other sites

this will only work if you have my fix (to display the referral info on orders.php.. i posted it earlier in this topic)

you set it to delete automatically once you set the order status to a designated status (like "shipped" or something)

 

in admin/classes/orders.php, look for:

'date_purchased' => $order['date_purchased'],

 

add below:

'orders_status' => $order_status['orders_status_name'],

 

 

in admin/orders.php look for:

echo ' <tr>' . "\n" .
' <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" .
' </tr>' . "\n";
}
?>

 

 

add below:

<?php
if ($order->customer['orders_status'] == '6'){
tep_db_query("delete from " . TABLE_SOURCES_OTHER . " where customers_id = '$cID'");
} else {
}
?>

 

where the '6' is; enter whatever status you don't need the referrals for anymore.

 

drawbacks: it will empty what they typed but their customer_id will still be in the sources_other table. because the query is calling this field, i don't think it's possible to delete with this structure as-is. i'm not overly advanced in php, so i'm hoping someone more experienced than myself can clean this up a bit :)

 

so instead of joe schmoe's typed referrer being "some guy named fred", it will read "Other" (or whatever your default "other" is)

 

not sure if this is what you needed or not... if not, you could probably achieve what you were looking for by using pieces of my code

Edited by eww
Link to comment
Share on other sites

your code is not doing what I need it to.

 

I have your previous order.php code installed where it shows the referral on the order details page, that's okay.

 

on the order page where you see the list of orders, I need a new column there that displays each referral. As it does for the customer page. I tried copy/pasting the code from the customer.php page but the orders.php query doesnt search the customers_info table and I dont know how to make it search that.

 

Anyway, I just need a column in the orders.php page displaying the referral the customer chose

 

 

jeff

Link to comment
Share on other sites

  • 3 weeks later...

Hi I recently just installed Version 1.5 of your module and it seems to work great. Thankyou very much for sharing this with the OSC community.

 

However I am having a little problem.

 

I was extremely carefull in installing the module and everything seemed to go OK except when I Visit the Reports > Referral Sources page it is acting like a language file is missing.

 

The main page heading is "HEADING_TITLE"

 

The table heading to the right hand side is "TABLE_HEADING_VIEWED"

 

and the Other Referrals is "TEXT_OTHER"

 

Also when I click on TEXT_OTHER I get this page error

 

---------------------------------------------------------------------------------

 

HEADING_TITLE

 

TABLE_HEADING_REFERRALS TABLE_HEADING_VIEWED

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-30, 30' at line 1

 

select count(ci.customers_info_source_id) as no_referrals, so.customers_id, ci.customers_info_date_account_created, so.sources_other_name as sources_name from customers_info ci, sources_other so where ci.customers_info_source_id = '9999' and so.customers_id = ci.customers_info_id group by so.sources_other_name order by no_referrals DESC limit -30, 30

 

[TEP STOP]

 

---------------------------------------------------------------------------------

 

I was very carefull to upload all altered files and also the required new files.

 

Any hlep would be great

 

And once again thanks for the Fantastic MOD.

 

Regards

 

FunkyM

Link to comment
Share on other sites

your code is not doing what I need it to.

 

I have your previous order.php code installed where it shows the referral on the order details page, that's okay.

 

on the order page where you see the list of orders, I need a new column there that displays each referral. As it does for the customer page. I tried copy/pasting the code from the customer.php page but the orders.php query doesnt search the customers_info table and I dont know how to make it search that.

 

Anyway, I just need a column in the orders.php page displaying the referral the customer chose

jeff

ok ok NOW i understand. (somethimes i wonder how good my english skills really are!) :lol:

 

in admin/orders.php look for:

<td class="dataTableContent" align="center"><?php echo tep_datetime_short($orders['date_purchased']); ?></td>
<td class="dataTableContent" align="right"><?php echo $orders['orders_status_name']; ?></td>

 

 

add below:

<td class="dataTableContent" align="right"><?php
//rmh referral start
$cust_id_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '" . $orders['orders_id']. "'");
$cust_result = tep_db_fetch_array($cust_id_query);
$cID = $cust_result['customers_id'];
$source_query = tep_db_query("select customers_info_source_id from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$cID . "'");
$source = tep_db_fetch_array($source_query);

$entry_referral = tep_get_sources_name($source['customers_info_source_id'], $cust_result['customers_id']);
echo $entry_referral;
//rmh referral end
?></td>

 

you may have to fancy up the html tables to align it properly, but the code should work

Link to comment
Share on other sites

i think the original contributor of this disappeared, so i will try to answer your questions :)

 

 

Referral Sources page it is acting like a language file is missing.

there are language strings missing.

open up admin/includes/languages/english/referrals..php

 

and add the missing lines, like so:

define('TABLE_HEADING_REFERRALS', 'Referrals');

 

note the bold text. remove that and make it say WHATS_MISSING and for Referrals, do the same (but replace referrals with whatever you want it to say)

 

 

 

 

TABLE_HEADING_REFERRALS TABLE_HEADING_VIEWED

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-30, 30' at line 1

[TEP STOP]

i'm not very experienced with mysql / sql errors, so i'm going to take a guess and say add those lines to the english file and see if it helps. i don't recall running into this error when i first installed it to my shop, so likely if you go over the instructions a second time you'll probably notice you missed a , or something stupid like that. happens to me all the time :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...