Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How Did You Hear About Us - Support


Recommended Posts

I have a slight error. I have Total B2B installed and don't think it's mucking up this contribution but this is the error I'm getting.

 

Parse error: parse error, unexpected ';', expecting ')' in /usr2/home/handbags/www/catalog/create_account.php on line 268

 

I'm sure you'll need more info. Let me know what.

Link to comment
Share on other sites

  • Replies 318
  • Created
  • Last Reply

Top Posters In This Topic

Ok, I can create and account now but as soon as I hit submit

 

1062 - Duplicate entry '11' for key 1

 

insert into customers_info (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('11', '0', now())

 

[TEP STOP]

 

The contribs I am running currently are

 

Add Master Password

Anti Robot Registration

Choose Your Recipient for Contact Us Page

Down For Maintenance

Dynamic Meta Tags

Fax or Phone Credit Card Details through

Monthly Sales Report

NET30

New Customer Emails

Newsletter Unsubscribe

* Order Editor

orders_tracking

osC-CenterShop

OSC System Backup BETA

Random Header Image

Recover Cart Sales

Store Pickup Shipping Module

Total B2B

Updated spiders.txt

Visitor Web Stats

Who's Online Enhancement

 

I'm hoping someone who has these contributions installed ran into the same problem and has a fix.

Link to comment
Share on other sites

I looked at all the contributions I have added and don't see any *.sql files that conflicted with this contribution's *.sql file. If there was one anyways, wouldn't there be an error when I tried to upload the file via phpAdmin and not let me make the changes?

Link to comment
Share on other sites

Actually I think there is ... there is just so many things to look at!  Ack!

 

Well I did some checking. I found my error. Actually this works with all the contributions listed above. It's just maybe I didn't understand the instructions to clearly. All of the changes are additions except one part which is not really an addition but total change.

 

In /catalog/create_account.php

 

** tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");

 

//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 (SESSION_RECREATE == 'True') {

 

The //rmh referral start/end should replace any stock OEM code ** & ** which are the stock OEM code.

 

I just actually added to the code which is why I was getting this error and this may be why others got the same error. There are no instructions on adding or replacing, you have to search for the changes made in the diff files provided by the author.

 

Anyways, I looked into the db beforehand and could not find any of my contribs conflicting with the *.sql update provided with this contrib so it had to be something on my part.

 

I guess my impatience waiting for an answer actually paid off and it'll now make me more proactive in searching for my own answers rather than ask and expect and answer. :)

Link to comment
Share on other sites

Kudos for finding the problem yourself! You should feel proud. Many endusers want to be spoonfed. It helps you overall to find the problem and fix it yourself!

 

(Also, if you had read some previous post, they should have led you in the right direction. The problem is the multiple INSERT's & UPDATE's).

 

Also, it helps to allow more than 20 minutes for responses! :)

Edited by hobbzilla
Link to comment
Share on other sites

Update your database_tables.php lately? ;)

 

Thanks, that helped me fix my problem aswell! Great contrib, but confusing to update because of so many files! Instructions in a single text file with find and replace might be easier (for me at least :P)

 

Keep up the good work, and thanks!

Edited by theboywonder
Link to comment
Share on other sites

  • 2 weeks later...

I've installed this contribution, but there seems to go something wrong. The dropdown menu doesn't show, not when there is an refID in the url and neither when there is no refID. The code in create_account.php is:

<!-- //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' : '') . ' ' . (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 : '')) . ' ' . (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 -->

 

Is this ok?

Link to comment
Share on other sites

  • 2 weeks later...

Hey Ryan,

 

I'm upgrading from 1.2

 

I love the display of referrals in customers.php; I didn't even expect it and have been dying for it.

 

I have two questions.

 

1. How do I turn off the ref ID so the drop down always shows?

 

2. How do I make the other box only show when they select other, or at least that they can only type in the box when they have chosen other?

 

Thank you

 

Dhananjaya

I have moved on from oscommerce to magento and no longer monitoring this site.

Link to comment
Share on other sites

In admin, report, customer order totals, I figure theres a lot of room in there to put a column for how did you hear about us so you can see easily where your money is coming from. So I copied the code from customers.php in there and Voila! Well almost. I didn't get any errors and something is happening. The column is filled with --none-- instead of the referrals. And I was looking forward to making a contribution for a change, albeit a tiny one. Anyway, if anyone would like to take a look at the code and see if you have any suggestions, perhaps I can begin to learn how to be productive around here.

 

<?php

/*

$Id: stats_customers.php,v 1.31 2003/06/29 22:50:52 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

<script language="javascript" src="includes/general.js"></script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NUMBER; ?></td>

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td>

<!--// referral -->

<td class="dataTableHeadingContent" align="left"><?php echo TABLE_HEADING_REFERRED_BY; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_PURCHASED; ?> </td>

</tr>

<?php

if (isset($HTTP_GET_VARS['page']) && ($HTTP_GET_VARS['page'] > 1)) $rows = $HTTP_GET_VARS['page'] * MAX_DISPLAY_SEARCH_RESULTS - MAX_DISPLAY_SEARCH_RESULTS;

$customers_query_raw = "select c.customers_firstname, c.customers_lastname, sum(op.products_quantity * op.final_price) as ordersum from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS . " o where c.customers_id = o.customers_id and o.orders_id = op.orders_id group by c.customers_firstname, c.customers_lastname order by ordersum DESC";

$customers_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $customers_query_raw, $customers_query_numrows);

// fix counted customers

$customers_query_numrows = tep_db_query("select customers_id from " . TABLE_ORDERS . " group by customers_id");

$customers_query_numrows = tep_db_num_rows($customers_query_numrows);

 

$rows = 0;

$customers_query = tep_db_query($customers_query_raw);

while ($customers = tep_db_fetch_array($customers_query)) {

$rows++;

 

if (strlen($rows) < 2) {

$rows = '0' . $rows;

}

// rmh referral 1.3

$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']);

// end rmh referral 1.3

 

?>

<tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='<?php echo tep_href_link(FILENAME_CUSTOMERS, 'search=' . $customers['customers_lastname'], 'NONSSL'); ?>'">

<td class="dataTableContent"><?php echo $rows; ?>.</td>

<td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_CUSTOMERS, 'search=' . $customers['customers_lastname'], 'NONSSL') . '">' . $customers['customers_firstname'] . ' ' . $customers['customers_lastname'] . '</a>'; ?></td>

<!--//-- rmh referral hack-->

<td class="dataTableContent" align="left"><?php echo $entry_referral; ?></td>

<!--//-- rmh referral hack-->

<td class="dataTableContent" align="right"><?php echo $currencies->format($customers['ordersum']); ?> </td>

</tr>

<?php

}

?>

</table></td>

</tr>

<tr>

<td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText" valign="top"><?php echo $customers_split->display_count($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?></td>

<td class="smallText" align="right"><?php echo $customers_split->display_links($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?> </td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table></td>

<!-- body_text_eof //-->

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

I have moved on from oscommerce to magento and no longer monitoring this site.

Link to comment
Share on other sites

I've installed this contribution, but there seems to go something wrong. The dropdown menu doesn't show, not when there is an refID in the url and neither when there is no refID.

....

Is this ok?

 

Have you created any sources? Do you have the option in admin set to show the "other" box?

Link to comment
Share on other sites

Thanks for an excelent contribution.

 

I installed it last week. The catalog side seems to work fine but i am not able to get it working in admin.

 

In admin, I see"BOX_CUSTOMERS_REFERRALS" under customers. when I click on it, I get this error message "----/admin/FILENAME_REFERRALS was not found on this server."

 

I reinstalled the contribution several times without any luck. Can someone help me to fix this error.

 

Thanks

 

dumb

Link to comment
Share on other sites

Hi,

 

Thanks for this great contribution, Ryan. :D

 

We are using an osC release 'snapshot' _somewhere_ between MS-1 and MS-2, so possibly the following problem is because of that ? Anyway, in create_account, we are getting:

 

Fatal error: Call to a member function on a non-object in ..../create_account.php on line 21

 

and line 21 is .........

 

        $messageStack->add(ENTRY_SOURCE_ERROR, 'create_account');

 

after initially getting the error message, i did change line 21 in the hope of fixing this, the original line as supplied in the contrib, was of this format:

 

        $messageStack->add('create_account', ENTRY_SOURCE_ERROR);

 

but when I looked at the messagestack class, and also other PHP files that used the class, this line in the class:

 

$this->add($messageToStack[$i]['text'], $messageToStack[$i]['type']);

 

told me it should be around the other way, hence I changed it, but still get the error message. :(

 

There doesn't seem to be any other people having this sort of problem. I have determined that the constant ENTRY_SOURCE_ERROR is being set correctly.

 

Thanks,

 

Peter

Link to comment
Share on other sites

  • 2 weeks later...

Great Contribution. Just wanted to let everyone know I posted update:

http://www.oscommerce.com/community/contri...ons,2159/page,8

 

I have included the instructions for those that do not have a clean osC site. Thanks to Ryan Hobbs. He took the time to write it, so I took the time to compare files.

Link to comment
Share on other sites

First of all, respects are due: Great Contribution! Hits the spot!

 

I was getting an error earlier and found solution in forum posts, so that was great too.

 

This was the part of the code I was having trouble with. I had added, but should have replaced the create_account.php code which applies to this section. Anyway this is what it looks like now and it works, no more error.

 

      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 . "'");

//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 (SESSION_RECREATE == 'True') {
       tep_session_recreate();
     }

 

except I am having a problem in the admin panel. I am getting data titles instead of corresponding text.

 

referral-error.jpg

 

Have I forgotten something?

Link to comment
Share on other sites

I must be getting good at this, two problems solved in one day by using the forums and before getting a response. One of those mistakes was of my own making and concerns the last problem below, I simply forgot to do this:

 

------------------###############---------------------

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

------------------###############---------------------

 

 

First of all, respects are due: Great Contribution! Hits the spot!

 

I was getting an error earlier and found solution in forum posts, so that was great too.

 

This was the part of the code I was having trouble with. I had added, but should have replaced the create_account.php code which applies to this section. Anyway this is what it looks like now and it works, no more error.

 

 ? ? ?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 . "'");

//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 (SESSION_RECREATE == 'True') {
? ? ? ?tep_session_recreate();
? ? ?}

 

except I am having a problem in the admin panel. I am getting data titles instead of corresponding text.

 

referral-error.jpg

 

Have I forgotten something?

Link to comment
Share on other sites

the english definition file for the particular page needs to be updated, with the defines for the text missing.

 

I must be getting good at this, two problems solved in one day by using the forums and before getting a response. One of those mistakes was of my own making and concerns the last problem below, I simply forgot to do this:

 

------------------###############---------------------

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

------------------###############---------------------

Link to comment
Share on other sites

Because many people don't really care what they answer, is there a way to randomize the display in the scroll down menu of referral options. Statistically, it should weed those who aren't answering seriously.

 

Try this:

 

in catalog/includes/functions/general.php in function tep_get_sources() change the order by sources_name to RAND()

 

HTH

Link to comment
Share on other sites

Thank you very much, this will do the job just fine.

 

No Problem. However, wouldn't you be better off knowing that the person is selecting the first one from the dropdown just because they are lazy? If you randomize it, your results will _look_ more correct, but because it is random, you won't have the information that you and I already know to be true.

 

Prior to Rand()

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

AOL = 72%

Google = 12%

MSN = 2%

Yahoo = 14%

 

After Rand()

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

AOL = 24%

Google = 28%

MSN = 18%

Yahoo = 30%

 

See what I mean, because AOL is at the top, that number is artificially inflated due to laziness. However the other statistics were selected and at least have validity to them. After Rand() there is no validity for any statistic. So, the real question to ask is if you are wanting valid data? If so, I wouldn't recommend RAND(). If not, then just make up arbitrary numbers to report to your supervisor/superior/cohorts and don't even use the "how did you hear about us" contrib!

 

A better solution would be to store in a session the referring site from where they came, and compare a table of known referral values to the sources table and automatically have that selected if it is available.. otherwise have the "Please Select" option as the default.

 

Your thoughts?

Link to comment
Share on other sites

Great Contribution.  Just wanted to let everyone know I posted update:

http://www.oscommerce.com/community/contri...ons,2159/page,8

 

I have included the instructions for those that do not have a clean osC site.  Thanks to Ryan Hobbs.  He took the time to write it, so I took the time to compare files.

 

 

I just downloaded this updated version (as I don't have a vanilla install), and I haven't installed it yet, but it looks really handy!

 

Just wanted to say that I couldn't find the .sql file included with that download, so I had to download the Dec 16th version in order to get the sql file.

 

Not particularly important, but might be confusing for new users if they can't find the sql file to update the database. ^_^

 

(unless I'm just blind and the sql file is burried somewhere in the Feb 14th update, in which case you can just ignore me :blush: )

Edited by Taipa
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...