Jump to content
Sign in to follow this  
bmcewan

Purchase Without Account Updated & Admin Functionality

Recommended Posts

It looks like the update file has some other modifications/contibutions installed on login.php include_left_nav.php seems like Brett has some theme installed in his and is not compatiable with standard PWA login.php, if you made a back-up of your original PWA login.php try replacing line 142 or near there, Find:

 

<?php

if (PWA_ON == 'true') {

require(DIR_WS_INCLUDES . FILENAME_PWA_PWA_LOGIN);

} else {

require(DIR_WS_INCLUDES . FILENAME_PWA_ACC_LOGIN);

}

?>

 

replace with:

 

<?php

if ( (PWA_ON == 'true') and ($cart->count_contents() >= 1) ) {

require(DIR_WS_INCLUDES . FILENAME_PWA_PWA_LOGIN);

} else {

require(DIR_WS_INCLUDES . FILENAME_PWA_ACC_LOGIN);

}

?>

 

This stops PWA showing up upon New Customer Sign-up.

 

and you can replace the two login files acc and pwa in /includes from the 1.1 update to make use of the new Tab order.

 

this should fix it.

MaxiDVD :lol:

Share this post


Link to post
Share on other sites

Nice contribution. After installing and running a test order, I noticed that a customer who purchases without an account receives an email as though that customer had created a new account... also after a purchase, that customer will also get a text email address with a link to a detailed invoice that can only be accessed by someone with an account.

 

Has anyone thought of a solution to these problems?


-D. M. 8)

Share this post


Link to post
Share on other sites

Nevermind, I figured it out -

 

to remove the welcome email for the 'non accounts', find and comment out this line in both Order_Process.php files:

 

tep_mail($name, $email_address, EMAIL_SUBJECT, nl2br($email_text), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');

 

To remove the detailed invoice link in the emailed text invoice, find in checkout_process.php

$email_order = STORE_NAME . "n" . 

                EMAIL_SEPARATOR . "n" . 

                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "n" .

                EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "n" .

                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "nn";

and replace with:

if (!tep_session_is_registered('noaccount')) {  

 $email_order = STORE_NAME . "n" . 

                EMAIL_SEPARATOR . "n" . 

                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "n" .

                EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "n" .

                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "nn";

 } else {

 $email_order = STORE_NAME . "n" . 

                EMAIL_SEPARATOR . "n" . 

                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "n" .

                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "nn";

 

Also if you're implementing the fix that removes keeps the usernames of nonaccounts from being stored in the database, you might want to get rid of the 'Newsletter' box in both 'Order_Check.php' files, as it's kind of unneccessary.

 

I hope this helped someone.


-D. M. 8)

Share this post


Link to post
Share on other sites

I've installed PWA, and it works great, but one problem:

 

Since an account is actually created for the customer, and a customer tries to return and purchase another item, using the same email address, the system doesn't let the customer use the same email address for the purchase.

 

It sounds as if there is a fix for this, but I can't locate it in this thread.

Share this post


Link to post
Share on other sites

I can't remember who the original author if this was, but this seems to be a fix... this mod clears out the account on checkout, so it fixes the problem of if they purchase something and come back. Well, whoever the original poster of this fix was, sorry I forgot to write down your name. Here's that person's fix:

 

Posted: Thu Jul 03, 2003 11:13 pm    Post subject:    

 

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

 

I had the same problem, when I did some test purchases without creating an account. I was able to go back and click on 'Password Forgotten?' link and get a new password and of course get access to the account, which this is not the way it is supposed to work.  

 

Here is the way I fixed it:  

in /catalog/checkout_success.php insert the following code right before the HTML code but within the php tags.  

Code:  

 

     // Added a check for a Guest checkout and cleared the session - 030411  

     if (tep_session_is_registered('noaccount')) {  

            tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . tep_db_input($customer_id) . "'");  

          tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . tep_db_input($customer_id) . "'");  

          tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . tep_db_input($customer_id) . "'");  

          tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . tep_db_input($customer_id) . "'");  

          tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . tep_db_input($customer_id) . "'");  

          tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . tep_db_input($customer_id) . "'");  

        tep_session_destroy();  

         

     }  

 

 

 

this will get rid of the customer account information, therefore the customer will not have access to the account nor the order history but you will keep the order information.  

 

If you have any problems just let me know.

 

The only thing this doesn't take care of is if the customer closes his / her browser or leaves your site after putting in their information in the Order_Info.php, but before completing their checkout.... then obviously the customer information is still saved... I haven't been able to think of any logical or easy way to fix this. Shouldn't be a problem most of the time though.


-D. M. 8)

Share this post


Link to post
Share on other sites

Looks like that is what I need.

 

I'll hook it up and give it a spin.

 

Curious, since this PWA is a mod and not a build in item, how many people actually get a lot of repeat customers?

 

I know for my own online experience, I rarely go back to a website within one year to purchase something again (except a amazon or yahoo store).

Share this post


Link to post
Share on other sites

I added the copy you suggested, but it still creates an account. Now, I am a relative newbie to php, but have dabbled in cgi for years, so I usually catch on pretty quick.

 

Here's the code to checkout_success.php:

 

<?php

/*

 $Id: checkout_success.php,v 1.48 2003/02/17 11:51:16 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');

 

// if the customer is not logged on, redirect them to the shopping cart page

 if (!tep_session_is_registered('customer_id')) {

   tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

 }

 

 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'update')) {

   $notify_string = 'action=notify&';

   $notify = $HTTP_POST_VARS['notify'];

   if (!is_array($notify)) $notify = array($notify);

   for ($i=0, $n=sizeof($notify); $i<$n; $i++) {

     $notify_string .= 'notify[]=' . $notify[$i] . '&';

   }

 if (strlen($notify_string) > 0) $notify_string = substr($notify_string, 0, -1);

// removed for checkout without account by varn

 tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));

}

// end remove for checkout without account by varn

// added for checkout without account by varn

// Added a check for a Guest checkout and cleared the session - 030411  

if (tep_session_is_registered('noaccount')) {  

tep_session_destroy();  

tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL'));  

}

else {  

tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string, 'SSL'));  

}

// end added for checkout without account by varn

 

 

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SUCCESS);

 

 $breadcrumb->add(NAVBAR_TITLE_1);

 $breadcrumb->add(NAVBAR_TITLE_2);

 

 $global_query = tep_db_query("select global_product_notifications from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customer_id . "'");

 $global = tep_db_fetch_array($global_query);

 

 if ($global['global_product_notifications'] != '1') {

   $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . $customer_id . "' order by date_purchased desc limit 1");

   $orders = tep_db_fetch_array($orders_query);

 

   $products_array = array();

   $products_query = tep_db_query("select products_id, products_name from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . $orders['orders_id'] . "' order by products_name");

   while ($products = tep_db_fetch_array($products_query)) {

     $products_array[] = array('id' => $products['products_id'],

                               'text' => $products['products_name']);

   }

 }

// Added a check for a Guest checkout and cleared the session - 030411  

     if (tep_session_is_registered('noaccount')) {  

            tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . tep_db_input($customer_id) . "'");  

          tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . tep_db_input($customer_id) . "'");  

          tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . tep_db_input($customer_id) . "'");  

          tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . tep_db_input($customer_id) . "'");  

          tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . tep_db_input($customer_id) . "'");  

          tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . tep_db_input($customer_id) . "'");  

        tep_session_destroy();  

         

     }

// end added a check for a guest checkout and cleared the session

?>

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

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

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

</head>

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

<!-- header //-->

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

<!-- header_eof //-->

 

<!-- body //-->

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

 <tr>

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

<!-- left_navigation //-->

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

<!-- left_navigation_eof //-->

   </table></td>

<!-- body_text //-->

   <td width="100%" valign="top"><?php echo tep_draw_form('order', tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'action=update', 'SSL')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

     <tr>

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

         <tr>

           <td valign="top"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_man_on_board.gif', HEADING_TITLE); ?></td>

           <td valign="top" class="main"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?><div align="center" class="pageHeading"><?php echo HEADING_TITLE; ?></div><br><?php echo TEXT_SUCCESS; ?><br><br>

<?php

 if ($global['global_product_notifications'] != '1') {

   echo TEXT_NOTIFY_PRODUCTS . '<br><p class="productsNotifications">';

 

   $products_displayed = array();

   for ($i=0, $n=sizeof($products_array); $i<$n; $i++) {

     if (!in_array($products_array[$i]['id'], $products_displayed)) {

       echo tep_draw_checkbox_field('notify[]', $products_array[$i]['id']) . ' ' . $products_array[$i]['text'] . '<br>';

       $products_displayed[] = $products_array[$i]['id'];

     }

   }

 

   echo '</p>';

 } else {

   echo TEXT_SEE_ORDERS . '<br><br>' . TEXT_CONTACT_STORE_OWNER;

 }

?>

           <h3><?php echo TEXT_THANKS_FOR_SHOPPING; ?></h3></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

       <td align="right" class="main"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

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

         <tr>

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

             <tr>

               <td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>

               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

             </tr>

           </table></td>

           <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

           <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

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

             <tr>

               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

               <td width="50%"><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>

             </tr>

           </table></td>

         </tr>

         <tr>

           <td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_DELIVERY; ?></td>

           <td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>

           <td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>

           <td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_FINISHED; ?></td>

         </tr>

       </table></td>

     </tr>

<?php if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_MODULES . 'downloads.php'); ?>

   </table></form></td>

<!-- body_text_eof //-->

   <!--BOF remove right column--

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

-- EOF remove right column-->

<!-- right_navigation //-->

<!--BOF remove right column--

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

<!-- EOF remove right column-->

<!-- right_navigation_eof //-->

   </table></td>

 </tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

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

<!-- footer_eof //-->

<br>

</body>

</html>

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

 

Did I mess something up, where it is ignoring the command to delete the database?

 

Thanks for your help, I really would like to use this contribution, but I need to get it to not create accounts when it's not supposed to....

Share this post


Link to post
Share on other sites

I'm looking through your checkout_success code, and it looks as though you've installed it right.

 

So... it should create an account at Order_info.php and after checkout_success, erase that account. It's not doing that? I'm not sure. That same code is working on my site, but then again, I'm really not all that good with this .php stuff. I wish I could be more helpful. Maybe someone else will have some insights.


-D. M. 8)

Share this post


Link to post
Share on other sites

Now, maybe I messed up my order processing somewhere.

 

When I finish the order (it is complete) I don't get a "your order is complete, thanks, have a nice day" type page. It just takes me back to my default.php page.

 

Is perhaps something there missing?

 

When an order is completed on your site, do you get an order confirmation page that says "thanks for the order?"

 

I would expect one to be delivered, at the very least, to inform the customer that their order was indeed taken.

Share this post


Link to post
Share on other sites

that sounds similar to a bug I used to have when using an older snapshot. Actually, try this:

 

take a look at this part of your code:

// Added a check for a Guest checkout and cleared the session - 030411 

if (tep_session_is_registered('noaccount')) { 

tep_session_destroy(); 

tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL')); 

} 

else { 

tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string, 'SSL')); 

}

 

- change both of the tep_redirect lines back to:

 

tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));

 

I think this might have something to do with it. That's the change I made on my site. I know that on my site, if I complete a checkout logged in, it shows the confirmation screen as normal and then takes me back to the default page. If I complete a checkout with a temporary account, it takes me to a confirmation screen, and then back to an empty shopping cart, then back to the default page (still a little bug I'm working on).

 

I think the tep_redirect part in the purchase without account code is based on an older standard, so you might be better off trying to stick with what's current wherever possible... though I'm not sure. Well, give it a shot and let's see if it works.


-D. M. 8)

Share this post


Link to post
Share on other sites

dmGremlin

 

The last couple of code snippets you have posted have been very benificial, I think the last two pages of code snippets should be put into and update version of PWA, also the tep_encrypt password should be changed to save furthur hassle as it cause to much drama for newbies. and add the PWA facelift, I dont have the time to add the fixes/updates to the last package, even though MS2 is due for release soon Im sure a lot of people will still continue to use MS1 for quiet a while.

 

Just some thoughts. :lol:

 

Cheers MaxiDVD

Share this post


Link to post
Share on other sites

Just curious though, what's the "$notify_string" do?

 

One of the tep redirects has this, the other doesn't, and it looks there's an "else" statement. Do the first one if no SSL, else, do the other one uf there is SSL.

 

Trying to get a grasp on what I am actually editing.

 

Can't wait for MS2.2, anyone know if it has the PWA included? I searched the update list, and didn't see it listed.

Share this post


Link to post
Share on other sites

Hey thanks MaxiDVD - glad I could be helpful... :) Yeah, MS2.2 - I've done so many modifications (19 contributions and counting so far, plus a ton of my own modifications) to my store, upgrading for me could be kind of ridiculous. I've taken a peek at the workboard and the weekly updates, but I couldn't find any mention of whether or not they were including any contributions. The daily snapshot I installed my site from was only from two months ago so maybe I can manually update...

 

I think if the PWA were to be intigrated, I would want to see a slightly different handling of the process of removing the customer account from the database, maybe even have all the customer details stored in a cookie instead, and have a duplicate checkout path for people checking out without an account that reads the info from the cookie? Either that or maybe have some kind of javascript that can tell if the user closes their browser before checkout_success and erases the temporary customer info from the database at that time through Javascriptiing... though I don't know if that's possible.

 

As for the logic of that last bit of code...

 

as far as I can tell, the if statement first checks to see if the customer is a 'noaccount', if so - destroys the session and redirects them... somewhere. If not, it keeps the session and redirects them somewhere else. It would be important to destroy the session if the account is a 'noaccount' but not if the user was logged in.

 

I noticed that in later versions of the code for the rest of osCommerce, they have removed the 'NONSSL' and 'SSL' parts. I'm not entirely sure why, but I figured it might be a good idea not to add them back in. As far as the $notify_string, I really have no idea. If I were to guess, I'd say the $notify_string takes you to the last page of the checkout.

 

My thinking was, since the essence of what this PWA addition was trying to do was simply to destroy the session at checkout if the customer was a 'noaccount', I tried to alter as little as possible from my original code to make that happen. I wish I could be more specific, but I have only a very crude understanding of php.


-D. M. 8)

Share this post


Link to post
Share on other sites

dmGremlin,

thanks for your insights, i updated the mentioned files now whenever someone goes to make a purchase, they get directed to the auth gateway, enter credit card info and now get this error message:

 

Parse error: parse error in

/home/virtual/site83/fst/var/www/html/catalog/checkout_process.php on line

287

 

here is the checkout_process.php

 

<?php

/*

 $Id: checkout_process.php,v 1.127 2003/04/08 22:37:20 dgw_ Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2003 osCommerce



 Released under the GNU General Public License

*/



 include('includes/application_top.php');



// if the customer is not logged on, redirect them to the login page

 if (!tep_session_is_registered('customer_id')) {

   $navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));

   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

 }

 

 if (!tep_session_is_registered('sendto')) {

   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

 }



 if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) {

   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

}



// avoid hack attempts during the checkout procedure by checking the internal cartID

 if (isset($cart->cartID) && tep_session_is_registered('cartID')) {

   if ($cart->cartID != $cartID) {

     tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

   }

 }



 include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);



// load selected payment module

 require(DIR_WS_CLASSES . 'payment.php');

 $payment_modules = new payment($payment);



// load the selected shipping module

 require(DIR_WS_CLASSES . 'shipping.php');

 $shipping_modules = new shipping($shipping);



 require(DIR_WS_CLASSES . 'order.php');

 $order = new order;



// load the before_process function from the payment modules

 $payment_modules->before_process();



 require(DIR_WS_CLASSES . 'order_total.php');

 $order_total_modules = new order_total;



 $order_totals = $order_total_modules->process();



 $sql_data_array = array('customers_id' => $customer_id,

                         'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],

                         'customers_company' => $order->customer['company'],

                         'customers_street_address' => $order->customer['street_address'],

                         'customers_suburb' => $order->customer['suburb'],

                         'customers_city' => $order->customer['city'],

                         'customers_postcode' => $order->customer['postcode'], 

                         'customers_state' => $order->customer['state'], 

                         'customers_country' => $order->customer['country']['title'], 

                         'customers_telephone' => $order->customer['telephone'], 

                         'customers_email_address' => $order->customer['email_address'],

                         'customers_address_format_id' => $order->customer['format_id'], 

                         'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'], 

                         'delivery_company' => $order->delivery['company'],

                         'delivery_street_address' => $order->delivery['street_address'], 

                         'delivery_suburb' => $order->delivery['suburb'], 

                         'delivery_city' => $order->delivery['city'], 

                         'delivery_postcode' => $order->delivery['postcode'], 

                         'delivery_state' => $order->delivery['state'], 

                         'delivery_country' => $order->delivery['country']['title'], 

                         'delivery_address_format_id' => $order->delivery['format_id'], 

                         'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 

                         'billing_company' => $order->billing['company'],

                         'billing_street_address' => $order->billing['street_address'], 

                         'billing_suburb' => $order->billing['suburb'], 

                         'billing_city' => $order->billing['city'], 

                         'billing_postcode' => $order->billing['postcode'], 

                         'billing_state' => $order->billing['state'], 

                         'billing_country' => $order->billing['country']['title'], 

                         'billing_address_format_id' => $order->billing['format_id'], 

                         'payment_method' => $order->info['payment_method'], 

                         'cc_type' => $order->info['cc_type'], 

                         'cc_owner' => $order->info['cc_owner'], 

                         'cc_number' => $order->info['cc_number'], 

                         'cc_expires' => $order->info['cc_expires'], 

                         'date_purchased' => 'now()', 

                         'orders_status' => $order->info['order_status'], 

                         'currency' => $order->info['currency'], 

                         'currency_value' => $order->info['currency_value']);

 tep_db_perform(TABLE_ORDERS, $sql_data_array);

 $insert_id = tep_db_insert_id();

 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {

   $sql_data_array = array('orders_id' => $insert_id,

                           'title' => $order_totals[$i]['title'],

                           'text' => $order_totals[$i]['text'],

                           'value' => $order_totals[$i]['value'], 

                           'class' => $order_totals[$i]['code'], 

                           'sort_order' => $order_totals[$i]['sort_order']);

   tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);

 }



 $customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';

 $sql_data_array = array('orders_id' => $insert_id, 

                         'orders_status_id' => $order->info['order_status'], 

                         'date_added' => 'now()', 

                         'customer_notified' => $customer_notification,

                         'comments' => $order->info['comments']);

 tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);



// initialized for the email confirmation

 $products_ordered = '';

 $subtotal = 0;

 $total_tax = 0;



 for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

// Stock Update - Joao Correia

   if (STOCK_LIMITED == 'true') {

     if (DOWNLOAD_ENABLED == 'true') {

       $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename 

                           FROM " . TABLE_PRODUCTS . " p

                           LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa

                            ON p.products_id=pa.products_id

                           LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

                            ON pa.products_attributes_id=pad.products_attributes_id

                           WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";

// Will work with only one option for downloadable products

// otherwise, we have to build the query dynamically with a loop

       $products_attributes = $order->products[$i]['attributes'];

       if (is_array($products_attributes)) {

         $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";

       }

       $stock_query = tep_db_query($stock_query_raw);

     } else {

       $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

     }

     if (tep_db_num_rows($stock_query) > 0) {

       $stock_values = tep_db_fetch_array($stock_query);

// do not decrement quantities if products_attributes_filename exists

       if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {

         $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];

       } else {

         $stock_left = $stock_values['products_quantity'];

       }

       tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

       if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {

         tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

       }

     }

   }



// Update products_ordered (for bestsellers list)

   tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");



   $sql_data_array = array('orders_id' => $insert_id, 

                           'products_id' => tep_get_prid($order->products[$i]['id']), 

                           'products_model' => $order->products[$i]['model'], 

                           'products_name' => $order->products[$i]['name'], 

                           'products_price' => $order->products[$i]['price'], 

                           'final_price' => $order->products[$i]['final_price'], 

                           'products_tax' => $order->products[$i]['tax'], 

                           'products_quantity' => $order->products[$i]['qty']);

   tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

   $order_products_id = tep_db_insert_id();



//------insert customer choosen option to order--------

   $attributes_exist = '0';

   $products_ordered_attributes = '';

   if (isset($order->products[$i]['attributes'])) {

     $attributes_exist = '1';

     for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

       if (DOWNLOAD_ENABLED == 'true') {

         $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename 

                              from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa 

                              left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

                               on pa.products_attributes_id=pad.products_attributes_id

                              where pa.products_id = '" . $order->products[$i]['id'] . "' 

                               and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' 

                               and pa.options_id = popt.products_options_id 

                               and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' 

                               and pa.options_values_id = poval.products_options_values_id 

                               and popt.language_id = '" . $languages_id . "' 

                               and poval.language_id = '" . $languages_id . "'";

         $attributes = tep_db_query($attributes_query);

       } else {

         $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");

       }

       $attributes_values = tep_db_fetch_array($attributes);



       $sql_data_array = array('orders_id' => $insert_id, 

                               'orders_products_id' => $order_products_id, 

                               'products_options' => $attributes_values['products_options_name'],

                               'products_options_values' => $attributes_values['products_options_values_name'], 

                               'options_values_price' => $attributes_values['options_values_price'], 

                               'price_prefix' => $attributes_values['price_prefix']);

       tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);



       if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {

         $sql_data_array = array('orders_id' => $insert_id, 

                                 'orders_products_id' => $order_products_id, 

                                 'orders_products_filename' => $attributes_values['products_attributes_filename'], 

                                 'download_maxdays' => $attributes_values['products_attributes_maxdays'], 

                                 'download_count' => $attributes_values['products_attributes_maxcount']);

         tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);

       }

       $products_ordered_attributes .= "nt" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];

     }

   }

//------insert customer choosen option eof ----

   $total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);

   $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];

   $total_cost += $total_products_price;



   $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "n";

 }



// lets start with the email confirmation

 if (!tep_session_is_registered('noaccount')) {  

 $email_order = STORE_NAME . "n" . 

                EMAIL_SEPARATOR . "n" . 

                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "n" . 

                EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "n" . 

                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "nn"; 

 } else { 

 $email_order = STORE_NAME . "n" . 

                EMAIL_SEPARATOR . "n" . 

                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "n" . 

                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "nn";

 if ($order->info['comments']) {

   $email_order .= tep_db_output($order->info['comments']) . "nn";

 }

 $email_order .= EMAIL_TEXT_PRODUCTS . "n" . 

                 EMAIL_SEPARATOR . "n" . 

                 $products_ordered . 

                 EMAIL_SEPARATOR . "n";



 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {

   $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "n";

 }



 if ($order->content_type != 'virtual') {

   $email_order .= "n" . EMAIL_TEXT_DELIVERY_ADDRESS . "n" . 

                   EMAIL_SEPARATOR . "n" .

                   tep_address_label($customer_id, $sendto, 0, '', "n") . "n";

 }



 $email_order .= "n" . EMAIL_TEXT_BILLING_ADDRESS . "n" .

                 EMAIL_SEPARATOR . "n" .

                 tep_address_label($customer_id, $billto, 0, '', "n") . "nn";

 if (is_object($$payment)) {

   $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "n" . 

                   EMAIL_SEPARATOR . "n";

   $payment_class = $$payment;

   $email_order .= $payment_class->title . "nn";

   if ($payment_class->email_footer) { 

     $email_order .= $payment_class->email_footer . "nn";

   }

 }

 tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);



// send emails to other people

 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {

   tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 }



// load the after_process function from the payment modules

 $payment_modules->after_process();



 $cart->reset(true);



// unregister session variables used during checkout

 tep_session_unregister('sendto');

 tep_session_unregister('billto');

 tep_session_unregister('shipping');

 tep_session_unregister('payment');

 tep_session_unregister('comments');



 tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));



 require(DIR_WS_INCLUDES . 'application_bottom.php');

?>

 

any help would be appreciated!

thx in advance

donato

Share this post


Link to post
Share on other sites

whoops! looks like there's a typo in the code I posted, actually I just forgot to add in the closing bracket.

 

at the very end of the code I posted on that last page, add a closing bracket thingy } to end the else statement like this:

 

} else { 

 $email_order = STORE_NAME . "n" . 

                EMAIL_SEPARATOR . "n" . 

                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "n" . 

                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "nn"; 

}

 

that should fix your parse error. Hmm... I wish I could edit my previous posts.

 

-D. M.


-D. M. 8)

Share this post


Link to post
Share on other sites

DM Gremlin

 

I removed the section you recommended that I comment out, the one that kills the session, and now the "fix" that you had put together, to delete the customer info from the database works great!

 

Thanks.

 

Now, if we could only figure out a way to kill the database if a customer exits our website, or closes out their browser. I guess something like that would involve using a cookie.

 

Now, that I almost have the site running the way I want it, I was going to change the look and feel, making it "mine", but I might just wait for 2.2....

 

Thanks again!

Share this post


Link to post
Share on other sites

Okey guys so far so good, but.......

 

my 'John Doe' client created no account, ordered some products..... got the mail with details, without 'detailed invoice-link'..... GOOD !!!

 

but when i change the orderstatus , he gets YES an email with the notice of the orderstatuschange AND a detail-invoice link !!!

 

how do i remove that one ??????

 

cu

 

Hans

Share this post


Link to post
Share on other sites

Maybe add "account created" date to orders.php, near where the checkbox is to send an email to the customer when you update the status of the order?

 

If the "account created" date is blank, uncheck the box, since they don't have an account, and don't send those customers an email?

 

I'm sure there's some way of doing this in a "else" statement:

 

If account date exists, then check the box for email to send. If no account date exists, then uncheck the box for email to send.

 

But I don't know how...

Share this post


Link to post
Share on other sites

Fatal error: Call to undefined function: tep_validate_password() in /home/fm/public_html/Order_Info_Process.php on line 290

 

After two hours of searching and trying to figure this one out...i now post for HELP!!!...i did the change line 349 in catalog/order_info_process.php.. did not help...below is my catalog/order_info_process.php file...please tell me what is wrong with line 290...looks fine to me.

 

 

<?php

/*

$Id: Order_Info_Process.php,v 0.56 2003/03/08 hpdl Exp $

by Richy C.

 

OSCommerce v2.2MS1

 

Modified versions of create_account.php and related

files. Allowing 'purchase without account'.

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CREATE_ACCOUNT_PROCESS);

 

define('FILENAME_ORDER_INFO', 'Order_Info.php');

define('FILENAME_ORDER_INFO_PROCESS', 'Order_Info_Process.php');

 

if (!@$HTTP_POST_VARS['action']) {

tep_redirect(tep_href_link(FILENAME_ORDER_INFO, '', 'NONSSL'));

}

 

$gender = tep_db_prepare_input($HTTP_POST_VARS['gender']);

$firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);

$lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);

$dob = tep_db_prepare_input($HTTP_POST_VARS['dob']);

$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);

$telephone = tep_db_prepare_input($HTTP_POST_VARS['telephone']);

$fax = tep_db_prepare_input($HTTP_POST_VARS['fax']);

$newsletter = tep_db_prepare_input($HTTP_POST_VARS['newsletter']);

// $password = tep_db_prepare_input($HTTP_POST_VARS['password']);

$password = tep_db_prepare_input('');

$confirmation = tep_db_prepare_input($HTTP_POST_VARS['confirmation']);

$street_address = tep_db_prepare_input($HTTP_POST_VARS['street_address']);

$company = tep_db_prepare_input($HTTP_POST_VARS['company']);

$suburb = tep_db_prepare_input($HTTP_POST_VARS['suburb']);

$postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);

$city = tep_db_prepare_input($HTTP_POST_VARS['city']);

$zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']);

$state = tep_db_prepare_input($HTTP_POST_VARS['state']);

$country = tep_db_prepare_input($HTTP_POST_VARS['country']);

 

$error = false; // reset error flag

 

if (ACCOUNT_GENDER == 'true') {

if (($gender == 'm') || ($gender == 'f')) {

$entry_gender_error = false;

} else {

$error = true;

$entry_gender_error = true;

}

}

 

if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {

$error = true;

$entry_firstname_error = true;

} else {

$entry_firstname_error = false;

}

 

if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {

$error = true;

$entry_lastname_error = true;

} else {

$entry_lastname_error = false;

}

 

if (ACCOUNT_DOB == 'true') {

if (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4))) {

$entry_date_of_birth_error = false;

} else {

$error = true;

$entry_date_of_birth_error = true;

}

}

 

if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {

$error = true;

$entry_email_address_error = true;

} else {

$entry_email_address_error = false;

}

 

if (!tep_validate_email($email_address)) {

$error = true;

$entry_email_address_check_error = true;

} else {

$entry_email_address_check_error = false;

}

 

if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {

$error = true;

$entry_street_address_error = true;

} else {

$entry_street_address_error = false;

}

 

if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {

$error = true;

$entry_post_code_error = true;

} else {

$entry_post_code_error = false;

}

 

if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {

$error = true;

$entry_city_error = true;

} else {

$entry_city_error = false;

}

 

if (!$country) {

$error = true;

$entry_country_error = true;

} else {

$entry_country_error = false;

}

 

if (ACCOUNT_STATE == 'true') {

if ($entry_country_error) {

$entry_state_error = true;

} else {

$zone_id = 0;

$entry_state_error = false;

$check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . tep_db_input($country) . "'");

$check_value = tep_db_fetch_array($check_query);

$entry_state_has_zones = ($check_value['total'] > 0);

if ($entry_state_has_zones) {

$zone_query = tep_db_query("select zone_id from " . TABLE_ZONES . " where zone_country_id = '" . tep_db_input($country) . "' and zone_name = '" . tep_db_input($state) . "'");

if (tep_db_num_rows($zone_query) == 1) {

$zone_values = tep_db_fetch_array($zone_query);

$zone_id = $zone_values['zone_id'];

} else {

$zone_query = tep_db_query("select zone_id from " . TABLE_ZONES . " where zone_country_id = '" . tep_db_input($country) . "' and zone_code = '" . tep_db_input($state) . "'");

if (tep_db_num_rows($zone_query) == 1) {

$zone_values = tep_db_fetch_array($zone_query);

$zone_id = $zone_values['zone_id'];

} else {

$error = true;

$entry_state_error = true;

}

}

} else {

if (!$state) {

$error = true;

$entry_state_error = true;

}

}

}

}

 

if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {

$error = true;

$entry_telephone_error = true;

} else {

$entry_telephone_error = false;

}

 

/*

$passlen = strlen($password);

if ($passlen < ENTRY_PASSWORD_MIN_LENGTH) {

$error = true;

$entry_password_error = true;

} else {

$entry_password_error = false;

}

 

if ($password != $confirmation) {

$error = true;

$entry_password_error = true;

}

*/

 

$entry_password_error = false;

/*

$check_email = tep_db_query("select customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "' and customers_id <> '" . tep_db_input($customer_id) . "'");

if (tep_db_num_rows($check_email)) {

$error = true;

$entry_email_address_exists = true;

} else {

$entry_email_address_exists = false;

}

*/

 

$entry_email_address_exists = false;

 

if ($error == true) {

$processed = true;

 

$breadcrumb->add('Order Info', tep_href_link(FILENAME_ORDER_INFO, '', 'NONSSL'));

$breadcrumb->add(NAVBAR_TITLE_2);

?>

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

<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

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

<?php require('includes/form_check.js.php'); ?>

</head>

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

<!-- header //-->

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

<!-- header_eof //-->

 

<!-- body //-->

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

<tr>

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

<!-- left_navigation //-->

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

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><?php echo tep_draw_form('account_edit', tep_href_link(FILENAME_ORDER_INFO_PROCESS, '',

'SSL'), 'post',

'onSubmit="return check_form();"') . tep_draw_hidden_field('action', 'process'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

<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_image(DIR_WS_IMAGES . 'table_background_account.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr//-->

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><?php include(DIR_WS_MODULES . 'Order_Info_Check.php'); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

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

<tr>

<td class="main" align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

</tr>

</table></td>

</tr>

</table></form></td>

<!-- body_text_eof //-->

<!--No right navigation-->

</tr>

<!-- body_eof //-->

 

<!-- footer //-->

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

<!-- footer_eof //-->

<br>

</body>

</html>

<?php

} else {

 

 

$check_customer_query = tep_db_query("select customers_id,

customers_firstname, customers_password, customers_email_address,

customers_default_address_id from " . TABLE_CUSTOMERS . "

where upper(customers_email_address) = '" . strtoupper($HTTP_POST_VARS['email_address']) . "' and

upper(customers_firstname) = '" . strtoupper($HTTP_POST_VARS['firstname']) . "' and

upper(customers_lastname) = '" . strtoupper($HTTP_POST_VARS['lastname']) . "'");

 

// if password is EMPTY (null) and e-mail address is same then we just load up their account information.

// could be security flaw -- might want to setup password = somestring and have it recheck here (during the first initial

// creation

 

 

$check_customer = tep_db_fetch_array($check_customer_query);

 

if (tep_db_num_rows($check_customer_query)) {

 

// strtoupper($check_customer['customers_firstname']) == strtoupper($HTTP_POST_VARS['firstname']) &&

// strtoupper($check_customer['customers_lastname']) == strtoupper($HTTP_PST_VARS['lastname'])) {

 

// match by e-mail, firstname, lastname

 

 

 

// Check that password is good

$pass_ok = tep_validate_password($password, $check_customer['customers_password']);

 

if ($pass_ok == false) {

$pass_ok = tep_validate_password('', $check_customer['customers_password']);

}

 

if ($pass_ok != true) {

tep_redirect(tep_href_link(FILENAME_LOGIN, 'login=fail', 'SSL'));

 

} else {

 

$check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . "

where customers_id = '" . $check_customer['customers_id'] . "' and address_book_id = '1'");

$check_country = tep_db_fetch_array($check_country_query);

$customer_id = $check_customer['customers_id'];

$customer_default_address_id = $check_customer['customers_default_address_id'];

$customer_first_name = $check_customer['customers_firstname'];

$customer_country_id = $check_country['entry_country_id'];

$customer_zone_id = $check_country['entry_zone_id'];

tep_session_register('customer_id');

tep_session_register('customer_default_address_id');

tep_session_register('customer_first_name');

tep_session_register('customer_country_id');

tep_session_register('customer_zone_id');

} // if-else $pass_ok

 

if ($HTTP_POST_VARS['setcookie'] == '1') {

setcookie('email_address', $HTTP_POST_VARS['email_address'], time()+2592000);

setcookie('password', $HTTP_POST_VARS['password'], time()+2592000);

setcookie('first_name', $customer_first_name, time()+2592000);

} elseif ( ($HTTP_COOKIE_VARS['email_address']) && ($HTTP_COOKIE_VARS['password']) ) {

setcookie('email_address', '');

setcookie('password', '');

setcookie('first_name', '');

} // if cookies

 

$date_now = date('Ymd');

tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(),

customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . $customer_id . "'");

 

} else {

// if customer_exist = NO

 

 

$sql_data_array = array('customers_firstname' => $firstname,

'customers_lastname' => $lastname,

'customers_email_address' => $email_address,

'customers_telephone' => $telephone,

'customers_fax' => $fax,

'customers_newsletter' => $newsletter,

'customers_password' => tep_encrypt_password($password),

'customers_default_address_id' => 1);

 

if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;

if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob);

 

tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

 

$customer_id = tep_db_insert_id();

 

$sql_data_array = array('customers_id' => $customer_id,

'address_book_id' => 1,

'entry_firstname' => $firstname,

'entry_lastname' => $lastname,

'entry_street_address' => $street_address,

'entry_postcode' => $postcode,

'entry_city' => $city,

'entry_country_id' => $country);

 

if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;

if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company;

if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;

if (ACCOUNT_STATE == 'true') {

if ($zone_id > 0) {

$sql_data_array['entry_zone_id'] = $zone_id;

$sql_data_array['entry_state'] = '';

} else {

$sql_data_array['entry_zone_id'] = '0';

$sql_data_array['entry_state'] = $state;

}

}

 

tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

 

tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . tep_db_input($customer_id) . "', '0', now())");

 

$customer_first_name = $firstname;

$customer_default_address_id = 1;

$customer_country_id = $country;

$customer_zone_id = $zone_id;

tep_session_register('customer_id');

tep_session_register('customer_first_name');

tep_session_register('customer_default_address_id');

tep_session_register('customer_country_id');

tep_session_register('customer_zone_id');

 

} // ELSE CUSTOMER=NO

 

// restore cart contents

$cart->restore_contents();

 

// build the message content

$name = $firstname . " " . $lastname;

 

if (ACCOUNT_GENDER == 'true') {

if ($HTTP_POST_VARS['gender'] == 'm') {

$email_text = EMAIL_GREET_MR;

} else {

$email_text = EMAIL_GREET_MS;

}

} else {

$email_text = EMAIL_GREET_NONE;

}

 

$email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;

tep_mail($name, $email_address, EMAIL_SUBJECT, nl2br($email_text), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');

 

// tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));

 

 

tep_session_register('noaccount');

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

 

}

 

require(DIR_WS_INCLUDES . 'application_bottom.php');

?>

 

 

Thanks in advance to anyone who can help me...Thank you

 

Chad Pazurek

http://www.fmrstl.com

Share this post


Link to post
Share on other sites

the password change was not working for me....'customers_password'=> tep_encrypt_password($password),...so i just put $password and is working fine now....

 

my biggest problem and only one i believe..:)... is that on checkout after you put name address etc etc and hit continue it goes directly to payment option then to confirm checkout....then after you confirm takes you shipping preference then to payment again then to confirm....please tell me what file i need to change and what part....this would probably play havoc to those paying with CC...thanks in advance for help....

 

Chad Pazurek

http://www.fmrstl.com

Share this post


Link to post
Share on other sites

the problem i am having is that once the order is completed the (went to auth gateway and entered credit card info) it will redirect u to the default.php and NOT the success page

if credit card is not approved, it redirects to the correct page, confirm order page where it states "there is an error processing your credit card"

any help with this?

i tired the suggested change with the tep_redirect code that was mentioned previously but all to no avail!!!

 

if anyone creates a regular account they too experience this...

can someone who is having success post their checkout_success.php file???

 

 

mine:

<?php

/*

 $Id: checkout_success.php,v 1.48 2003/02/17 11:51:16 hpdl Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2003 osCommerce



 Released under the GNU General Public License

*/



 require('includes/application_top.php');



// if the customer is not logged on, redirect them to the shopping cart page

 if (!tep_session_is_registered('customer_id')) {

   tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

 }



 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'update')) {

   $notify_string = 'action=notify&';

   $notify = $HTTP_POST_VARS['notify'];

   if (!is_array($notify)) $notify = array($notify);

   for ($i=0, $n=sizeof($notify); $i<$n; $i++) {

     $notify_string .= 'notify[]=' . $notify[$i] . '&';

   }

   if (strlen($notify_string) > 0) $notify_string = substr($notify_string, 0, -1);



// Added a check for a Guest checkout and cleared the session - 030411 

if (tep_session_is_registered('noaccount')) { 

tep_session_destroy(); 

tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string)); 

} 

else { 

tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string)); 

} 



 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SUCCESS);



 $breadcrumb->add(NAVBAR_TITLE_1);

 $breadcrumb->add(NAVBAR_TITLE_2);



 $global_query = tep_db_query("select global_product_notifications from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customer_id . "'");

 $global = tep_db_fetch_array($global_query);



 if ($global['global_product_notifications'] != '1') {

   $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . $customer_id . "' order by date_purchased desc limit 1");

   $orders = tep_db_fetch_array($orders_query);



   $products_array = array();

   $products_query = tep_db_query("select products_id, products_name from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . $orders['orders_id'] . "' order by products_name");

   while ($products = tep_db_fetch_array($products_query)) {

     $products_array[] = array('id' => $products['products_id'],

                               'text' => $products['products_name']);

   }

 }



// Added a check for a Guest checkout and cleared the session - 030411 

if (tep_session_is_registered('noaccount')) { 

tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . tep_db_input($customer_id) . "'"); 

tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . tep_db_input($customer_id) . "'"); 

tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . tep_db_input($customer_id) . "'"); 

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . tep_db_input($customer_id) . "'"); 

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . tep_db_input($customer_id) . "'"); 

tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . tep_db_input($customer_id) . "'"); 

tep_session_destroy(); 



} 

// end added a check for a guest checkout and cleared the session 



?>

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

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

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

</head>

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

<!-- header //-->

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

<!-- header_eof //-->



<!-- body //-->

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

 <tr>

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

<!-- left_navigation //-->

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

<!-- left_navigation_eof //-->

   </table></td>

<!-- body_text //-->

   <td width="100%" valign="top"><?php echo tep_draw_form('order', tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'action=update', 'SSL')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

     <tr>

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

         <tr>

           <td valign="top"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_man_on_board.gif', HEADING_TITLE); ?></td>

           <td valign="top" class="main"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?><div align="center" class="pageHeading"><?php echo HEADING_TITLE; ?></div><br><?php echo TEXT_SUCCESS; ?><br><br>

<?php

 if ($global['global_product_notifications'] != '1') {

   echo TEXT_NOTIFY_PRODUCTS . '<br><p class="productsNotifications">';



   $products_displayed = array();

   for ($i=0, $n=sizeof($products_array); $i<$n; $i++) {

     if (!in_array($products_array[$i]['id'], $products_displayed)) {

       echo tep_draw_checkbox_field('notify[]', $products_array[$i]['id']) . ' ' . $products_array[$i]['text'] . '<br>';

       $products_displayed[] = $products_array[$i]['id'];

     }

   }



   echo '</p>';

 } else {

   echo TEXT_SEE_ORDERS . '<br><br>' . TEXT_CONTACT_STORE_OWNER;

 }

?>

           <h3><?php echo TEXT_THANKS_FOR_SHOPPING; ?></h3></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

       <td align="right" class="main"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

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

         <tr>

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

             <tr>

               <td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>

               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

             </tr>

           </table></td>

           <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

           <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

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

             <tr>

               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

               <td width="50%"><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>

             </tr>

           </table></td>

         </tr>

         <tr>

           <td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_DELIVERY; ?></td>

           <td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>

           <td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>

           <td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_FINISHED; ?></td>

         </tr>

       </table></td>

     </tr>

<?php if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_MODULES . 'downloads.php'); ?>

   </table></form></td>

<!-- body_text_eof //-->

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

<!-- right_navigation //-->

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

<!-- right_navigation_eof //-->

   </table></td>

 </tr>

</table>

<!-- body_eof //-->



<!-- footer //-->

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

<!-- footer_eof //-->

<br>

</body>

</html>

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

Share this post


Link to post
Share on other sites

I commented out the following section, which brought back the confirmation page instead of going directly to default.php:

 

// Added a check for a Guest checkout and cleared the session - 030411

/* if (tep_session_is_registered('noaccount')) {

tep_session_destroy();

tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL'));

}

else {

tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string, 'SSL'));

}*/

// end added for checkout without account by varn

 

I think we are double deleting the account info (destroy session) and the other fix that has since been implemented since the above text was introduced into purchase without account.

 

It works for me now, when I commented out the above section. I guess I could remove it entirely....

 

Post back if it works or not...

Share this post


Link to post
Share on other sites
You still need those info for shipping and billing no ?

 

Not if the order consists of only downloadable goods and payment is by paypal. In fact, if that is the case, experience shows sales will drop very significantly. How do I know that? I sell them both ways: OSC (http://duxcw.com/store/catalog/default.php) and another php program (http://duxcw.com/pdf/index.html). OSC does about 1% of the sales of the other program. I'd rather use OSC because it is feature-rich. Larry

Share this post


Link to post
Share on other sites

Fatal error: Failed opening required 'includes/languages/english/FILENAME_CREATE_ACCOUNT_PROCESS' (include_path='.;c:php4pear') in C:webwebjunctiontwisterchatcomtwisterchat.comwwwsitesd2catalogOrder_Info_Process

.php on line 21

 

After selecting "Continue Without Registering" and Typing in all your info, I get this error message in the browser

 

:cry:

 

Thanks for your help

-Dennis

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×