Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Guest Accounts v. 2.0 for MS2


olby

Recommended Posts

Hi all.

 

I've uploaded a re-work of Guest-accounts by Ian Davidson on this link:

http://www.oscommerce.com/community/contributions,1511

 

This mod allows your customers to checkout, without creating an account (no password/newsletter).

When allowed in admin, there will be a new box on the login-page for guests.

Guests will not be asked for or see these options:

Password,

Newsletter

Products Notifications

The Create Account Success page

The Account created mail

My Account and Logoff (in header navigation)

 

Please post any bugs or guestions in this topic.

Best Regards

olby

Link to comment
Share on other sites

  • Replies 124
  • Created
  • Last Reply

Top Posters In This Topic

Just found that a small but important instrution was missing :oops:

 

You have to add a new field to table customers:

name: guest_flag

type: CHAR

Length: 1

Default 0

 

Sorry about that, will upload a new one to day.

Best Regards

olby

Link to comment
Share on other sites

Version 2.1a uploaded.

 

Besides some bug-fixes in the documentation, the Guest option is now only shown, when checking out from the cart.

 

All other instancies of "members only" just shows the normal login-page.

Best Regards

olby

Link to comment
Share on other sites

Hi.

 

I tried the contribution, since this is a functionality I really need, and it SEEMS to work -- but not quite.

 

My issues:

A) The first time I go through checkout to create a guest account, I get this error message:

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

Error!

 

Unable to determine the page link!

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

URL is /catalog/create_account.php

 

I've checked most of the board messages about this (e.g. "register_globals"), but none seem to apply. I didn't have this problem before applying the mod, so I'm sure it's related to this mod (or the way I applied it).

 

I'm not logged in via HTTP.

Server logs, access_log, error_log, messages, don't show any problem.

 

B) When I navigate back in the browser from the "unable to determine page link" error and then proceed again, I'm taken to the account creation page and everything looks fine. The guest user now obviously received a cookie, though, since on subsequent visits he's welcomes with "Welcome back,....". Unfortunately, there's no "sign off" link (since it's a guest user).

 

I'd appreciate any help with issue A at least.

I'm running osCommerce 2.2-MS2 on Linux (Apache) with

mod_php4-core-4.3.1-24

mod_php4-4.3.1-24

phpdoc-4.0.6-264

mod_php4-devel-4.3.1-24

phpMyAdmin-2.4.0-12

installed.

 

Thanks,

 

Daniel

Link to comment
Share on other sites

P.S. Even though I get "Unable to determine page link", the user account seems to have been created and the Cookie has been set. If I return to the start page from this error mesage, I'm greeted with "Welcome back,...".

Link to comment
Share on other sites

Hi.

 

Is the database entry really 'guest_flag' and not 'customer_guest_flag'??

 

You have to add a new field to table customers:

name: guest_flag

type: CHAR

Length: 1

Default 0

 

 

Roger

facts invariably distort the truth

Link to comment
Share on other sites

It works on MS2.2, EXCEPT the redirect when guests enter billing info. at

{http://mydomain/catalog/create_account.php?guest_account=true}

goes to create_account_success.php, and should go to checkout_shipping.php.

 

Why does it not go to checkout_shipping.php?

 

Here is the redirect script:

 

// Guest Account Start

if ($guest_account == true) {

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

} else {

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

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

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

}

// Guest Account End

 

 

Thanks for any thoughts, ideas, sympathy :P

Eric

Link to comment
Share on other sites

  • 2 weeks later...
Has anyone a solution to this problem "Unable to determine page link". I also have it on my site.

The problem seems to be related to an error in the array handling in php v4.3.1 and v4.3.2.

 

See this: http://www.oscommerce.com/forums/index.php?sho...query+was+empty

and this: http://www.oscommerce.com/community/bugs,1307

 

A solution would be to upgrade to php v4.3.3.

 

There is a workaround by setting the "State" to be mandatory in the address. Not very pretty though.

Link to comment
Share on other sites

Hello,

 

I've installed guest account 2.1 and it works fine,

but what i want is the following.

 

I only want to use the guest account. So people cannot register

for an account. They can only checkout as guest.

 

I removed the create_accout and the loginbox from the login page

so they only see something on the login page when there are products in

the cart. I there are no products in the cart they will see the message that

they can only checkout if there is something in the cart.

 

That all works fine, they get redirected th create_account.php/guest_account/true (safe urls)

 

But i they type in the browser create_account.php they get the normal login page. So what i want , if they type in create_account.php they have to be redirected to create_account.php/guest_account/true.

 

I don't want to display the normal create_account.php in any way. Only guest account and if there are no prods in cart , the login.php.

 

Is there a way to do this, can anybody help me?

 

Thanx

Link to comment
Share on other sites

  • 2 weeks later...

Updated Guest Accounts v. 2.0, 2.1, 2.1a to Guest Accounts 2.2:

 

- 2.1a had error in catalog/login.php - Replaced with v. 2.1

- 2.1a missing lines in /catalog/includes/languages/english/login.php - Merged with 2.1

- Added sql file + Updated instructions

- Updated instructions because all changed code wasn't marked with // guest account tag

 

Resolved issue: that 2.1a would install without errors but not fuction

 

Also - If errors appeared after install it is likely due to the miss lableing of the comments:

// guest account

I updated the instructions to indicate this. Some examples of improper tags are:

// guest_account

//  guest account

-missing start or stop tags

 

I hope this helps you guys out it took me a while to figure it out - (5 days).

New Download:

Link to comment
Share on other sites

this contribution is great i am not a programmer but i managed to change the order of the pages that the customer goes to. i used a combination of this and burt"s suggestion in the tips forum.i would like you guys to take a look and see if there is any problems with it if you like you can try it out just don't pay with paypal

http://webdesign125.com/tesyosc/default.php

any help would be appreciated

Link to comment
Share on other sites

Hi

I have just installed this contribution and am having the following problem....

 

When I checkout and get to the point of confirming my order I get the following error after confirmation....

 

Parse error: parse error, unexpected T_ELSE in c:\program files\apache group\apache\htdocs\catalog\checkout_success.php on line 98

 

But when I fill in the Add Comments About Your Order all works ok...

 

Here is the code in question...

 

<?php
/*
 $Id: checkout_success.php,v 1.49 2003/06/09 23:03:53 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);

   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 = '" . (int)$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 = '" . (int)$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 = '" . (int)$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']);
   }
 }
?>
<!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 ($guest_account == false) { // not a guest Account
   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;
   }
 else { // guest accounts action
   echo TEXT_GUEST_ORDERS . '<br><br>' . TEXT_CONTACT_STORE_OWNER;
 } // guest account end
?>
           <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'); ?>

Please help

Cheers Malc

Link to comment
Share on other sites

Installed on 2.2 and all working OK.

 

There are a couple of things...

 

On create_account.php/guest_account/true? there is an error on the page in IE.

 

Line 15 Char 37 Expected ')' Code 0

 

May be some kind of ssl issue as a missing ')' would induce a parse error. I checked the code and all the brackets appear to be present. I uploaded the file with the package, so the code is exactly as per the mod.

 

The rest of the process is smooth :-)

 

After checkout_success however, the redirect to default.php welcomes me as the user I just checkout out as! Supposedly having not stored my information...

 

I can then access (from the header) my account information, address book, sign up for newsletters et al.

 

To me, this slightly defeats the object and proves to the customer that actually we have collected a whole bunch of info about them.

 

I have tried to reset the session after redirecting from checkout_success, but to no avail. I have further complications as I have the login box mod in my column_left which appears with links to all the account info.

 

I can also order again with no prompt to create a new account, my details have been saved.

 

**I have force_session_cookie_use running, so I suspect the solution invloves generating an entirely new session/cookie***

 

(unfortunately, which I have no clue how to do :( )

 

Any suggestions welcome

Ian

Link to comment
Share on other sites

Exactly as the error states -- you have two Else statements in the same if:

  } else {
  echo TEXT_SEE_ORDERS . '<br><br>' . TEXT_CONTACT_STORE_OWNER;
 }
else { // guest accounts action
 echo TEXT_GUEST_ORDERS . '<br><br>' . TEXT_CONTACT_STORE_OWNER;
} // guest account end

which of course the PHP parser cannot handle. I don't have this contribution to look at, so you need to go take another look at what is supposed to be here.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi

Thanks for you help kymation, Its sorted out and now works...

 

Another issue

 

I can also order again with no prompt to create a new account, my details have been saved.

 

I am getting the same as above.... so I agree it does seem to defeat the object...

or am I missing something :P

 

Cheers Malc

Link to comment
Share on other sites

How can we not store cookies for guests?

 

As it is now, if a guest places an order but does not complete the payment process, and close the web page......the next time you come on the site you will see the Welcome guest and the cart will still have the items.

 

I guess you could have a logout, but normally people dont pay attention to that....the best thing to do would be to clear the cookies once a guest signs in and not store them....but how would you do that?

Link to comment
Share on other sites

.the best thing to do would be to clear the cookies once a guest signs in and not store them....but how would you do that?

Shorten the lifespan of a cookie. The default is 30 days; set it to one hour (or whatever time you want). The customer's cart will disappear and they will be logged out after an hour of inactivity. This is not perfect behavior, but it's probably the best you can get and still use cookies for tracking.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 2 weeks later...

I am SOOOO lost here guys :huh: . Don't laugh but how the hell do I do this part:

 

Changes to database: (the are the commands in the sql file) AC

 

Add this field to table customers:

# Add customers guest_flag values to each customer

ALTER TABLE `customers` ADD `guest_flag` CHAR( 1 ) NULL DEFAULT '0';

 

Add these 2 fields to table configuration by running these lines in phpmyadmin or what ever you prefer.

# Add admin-facility to Guest Accounts

INSERT INTO configuration_group VALUES (40, 'Guests', 'Guests settings', 40, 1);

INSERT INTO configuration VALUES ('', 'Guests accounts', 'GUEST_ON', 'true', 'Allow Customers to purchase without an account', 40, 1, '2003-09-09 13:07:44', '2003-09-09 12:10:51', NULL, 'tep_cfg_select_option(array(\'true\', \'false\'),');

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