Forums / Templates, Stylesheets, Page Layout / bypassing create account success with empty cart

bypassing create account success with empty cart

Locked
Results 1 to 20 of 28
This thread is locked. New replies are disabled.
14 Dec 2006, 10:40
#1
craftzombie avatar

craftzombie

Zen Follower

Join Date:
Jul 2006
Posts:
494
Plugin Contributions:
0

bypassing create account success with empty cart

I was wondering if this is possible and if it isn't a time consuming pain, can someone please guide me...

I changed my filenames.php file to bypass the create account success page and go directly to checkout_shipping. But if the person has an empty cart and is just signing up for an account, they get a "Login Time Out ---
Whoops! Sorry, but you are not allowed to perform the action requested. "

Is there some kind of "if" statement I can add to the create account.php that directs the customer to checkout_shipping if there are items in the cart and to maybe the home page or something if their cart is empty? (I could easily put a little note near the submit button on the create account page that lets them know which places they will be directed to depending on their circumstances)

Any help would be greatly appreciated :smile:

(or even better... could we change back the filename.php file back to normal and have the new "if" statement I mentioned above have the create account success page appear only if there are no items in the cart, and then have it not appear and just go to checkout_shipping if there are items in the cart?)

P.S. I hope I'm not confusing you!!
14 Dec 2006, 16:39
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: bypassing create account success with empty cart

/includes/modules/pages/create_account_success/header_php.php
lines 19-24 say this:
if (sizeof($_SESSION['navigation']->snapshot) > 0) {
  $origin_href = zen_href_link($_SESSION['navigation']->snapshot['page'], zen_array_to_string($_SESSION['navigation']->snapshot['get'], array(zen_session_name())), $_SESSION['navigation']->snapshot['mode']);
  $_SESSION['navigation']->clear_snapshot();
} else {
  $origin_href = zen_href_link(FILENAME_DEFAULT);
}


Try adding the following AFTER those lines:
// redirect customer to where they came from if their cart is not empty and they didn't click on create-account specifically
if ($_SESSION['cart']->count_contents() > 0) {
  if ($origin_href != zen_href_link(FILENAME_DEFAULT)) {
    zen_redirect($origin_href);
  }
}


I apologize - I haven't tested this. This strategy should work without having to make any changes to other files, including filenames.php. The line-numbers above are based on v1.3.6
14 Dec 2006, 21:39
#3
craftzombie avatar

craftzombie

Zen Follower

Join Date:
Jul 2006
Posts:
494
Plugin Contributions:
0

Re: bypassing create account success with empty cart

DrByte:


I apologize - I haven't tested this.


Don't you dare apologize! I am so grateful for your help! :D
15 Dec 2006, 01:23
#4
craftzombie avatar

craftzombie

Zen Follower

Join Date:
Jul 2006
Posts:
494
Plugin Contributions:
0

Re: bypassing create account success with empty cart

I was wondering...

Is it possible to allow Zen to accept duplicate email addresses (i.e. duplicate accounts)? I would like to make it so that if I made the password optional, they could place future orders using the same email address and not receive the "your email is already in our system" error when entering their billing info. Someone in an old thread mentioned that they did this to their cart. I'm not sure exactly how the db keeps track of info. Are customers kept track of based solely on their email or is there a customer # sort of thing going on?
15 Dec 2006, 02:00
#5
craftzombie avatar

craftzombie

Zen Follower

Join Date:
Jul 2006
Posts:
494
Plugin Contributions:
0

Re: bypassing create account success with empty cart

craftzombie:

I was wondering...

Is it possible to allow Zen to accept duplicate email addresses (i.e. duplicate accounts)? I would like to make it so that if I made the password optional, they could place future orders using the same email address and not receive the "your email is already in our system" error when entering their billing info. Someone in an old thread mentioned that they did this to their cart. I'm not sure exactly how the db keeps track of info. Are customers kept track of based solely on their email or is there a customer # sort of thing going on?


Okay, I was able to allow it to accept a duplicate email address by changing a few things to "false" in create_account.php. Is this a bad thing? This is a test site, but I'd like to make this a permanent feature. Am I going to cause problems in Zen by doing this?
15 Dec 2006, 07:35
#6
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
3

Re: bypassing create account success with empty cart

The only issue that I can think of is that customers may create multiple accounts by accident and won't be able to login into their "original" account then.

The actual orders administration uses the customers_id, not the e-mail address (I did not check this though, it's an assumption)).

A solution could be to let the customers choose if they want to create an account, and add a field to the customers table which stores this preference ("account_created"). And then check for this "account_created" field when a customers uses the same e-mail address a second time.
15 Dec 2006, 07:43
#7
craftzombie avatar

craftzombie

Zen Follower

Join Date:
Jul 2006
Posts:
494
Plugin Contributions:
0

Re: bypassing create account success with empty cart

paulm:

The only issue that I can think of is that customers may create multiple accounts by accident and won't be able to login into their "original" account then.

The actual orders administration uses the customers_id, not the e-mail address (I did not check this though, it's an assumption)).

A solution could be to let the customers choose if they want to create an account, and add a field to the customers table which stores this preference ("account_created"). And then check for this "account_created" field when a customers uses the same e-mail address a second time.


I was just about to email you. I've been working on this for several hours. I am using your code for the optional password. I edited other code to allow duplicate emails. I changed the "create account success" page to have a checkout button and a continue shopping button in case they were not checking out and were just creating an account. I am currently testing to see what happens with checkout/no password, checkout/password, logging in with email address that was used several times, etc..... check it out. You still have the link?
15 Dec 2006, 07:44
#8
craftzombie avatar

craftzombie

Zen Follower

Join Date:
Jul 2006
Posts:
494
Plugin Contributions:
0

Re: bypassing create account success with empty cart

paulm:

The actual orders administration uses the customers_id, not the e-mail address (I did not check this though, it's an assumption).


I assume you are correct because when I created new accounts with the same email address, they had different customer id's.
15 Dec 2006, 08:22
#9
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
3

Re: bypassing create account success with empty cart

Sounds interesting :-)

I just did a quick test. I entered the billing info, but no password and placed an order (the time_out page and error message is a bit confusing when clicking checkout after account creation while the cart is empty, I know that is not what the customer is supposed to do but.....).

Then I logged out, created a new account using the same e-mail address and entered a password. Then logged out again and logged into the account. Then I checked my account and I saw the order I placed the first time, when I had not entered a password! Obviously (?) this is not what we want.

I was a bit distracted while testing, so I might have mixed up things. But it looks like the data is mixed or merged. I hope to have time to run some more tests later on.
15 Dec 2006, 08:47
#10
craftzombie avatar

craftzombie

Zen Follower

Join Date:
Jul 2006
Posts:
494
Plugin Contributions:
0

Re: bypassing create account success with empty cart

Okay, this is gonna be long, so watch out!

paulm:

the time_out page and error message is a bit confusing when clicking checkout after account creation while the cart is empty, I know that is not what the customer is supposed to do but.....).


Yes, that was why I asked the first question in this thread. If they get to the create_account_success page with an empty cart and click on "continue" (which goes to the checkout_shipping page), they will get a timeout error.

I was trying to make it so that if the cart was empty, the create_account_success page would not appear and they would be redirected to the homepage or maybe even an alternate create_account_success where there are no "continue" buttons.

The code that DrByte gave me did not work (but I think our lines got crossed as to what I was trying to achieve). So what I have done instead is...

my create_account_success page has been altered to appear as if it not a create_account_success page. It's more of a "review the billing info you just entered page, if you were checking out then click here to continue, if you were not checking out, then click here to continue shopping" page. Hopefully if their cart is empty, they will click on "continue shopping" instead of "continue checkout" or they will get the timeout error.

paulm:

Then I logged out, created a new account using the same e-mail address and entered a password. Then logged out again and logged into the account. Then I checked my account and I saw the order I placed the first time, when I had not entered a password! Obviously (?) this is not what we want.


This is what my testing has uncovered..........

Scenario 1:

Customer checks out without entering a password.
They come back another day, checkout using the same email address, and this time enter a password.

Their account information only shows the address info and order info from the 2nd transaction where they entered a password (like it should).

This is all fine and dandy because the first time they ordered without entering a password, so that info isn't really supposed to be able to be viewed by them anyway.

Also, I would probably go into the db once a week and delete the customers who did not enter a password. In fact, is there a way to add to the admin, in the customer section, some type of asterisk or image next to their name that alerts us to whether or not a password was entered. That way we would have to go into phpmyadmin to see if the password field is filled? Then we could delete them directly from the admin.

Scenario 2:

Customer checks out with a password.
Customer comes back, enters same email address as before, but a new password.

If the customer ever comes back and tries to login, the second password they entered will not work. They can only login with the first password they entered. Now they won't be able to see order info from the second order. If they click on "forgot password" and get a temp password, it logs them into the first account, not the second one.

paulm:

A solution could be to let the customers choose if they want to create an account, and add a field to the customers table which stores this preference ("account_created"). And then check for this "account_created" field when a customers uses the same e-mail address a second time.


This would be wonderful. If only I knew how to code php..... (hint hint!)


So now I need to wrap my brain around this one! I'm pooped!

The alternative to all of this is to remove passwords and login altogether, but I'd like to keep it optional. I have shopped at a few sites where there was no "account" and finding out about order status was done through email. I send order confirmations and shipping confirmations via email anyway and don't see a point to an account for purposes of tracking orders. I do see a point to an account for purposes of saving addresses, saving products in the cart, that kind of thing.

(P.S. I have read EVERY thread on this topic and I don't want anyone to give me any crap about "this is the way Zen works" or "other sites require login", blah blah blah. I am just testing this and learning about Zen, this is not on a live site yet. I myself just want customers to enter a password and be done with it. I believe they should open an account. But unfortunately, not all of them feel this way and the whole point is for them to shop.)
15 Dec 2006, 09:16
#11
craftzombie avatar

craftzombie

Zen Follower

Join Date:
Jul 2006
Posts:
494
Plugin Contributions:
0

Re: bypassing create account success with empty cart

paulm:

Then I logged out, created a new account using the same e-mail address and entered a password. Then logged out again and logged into the account. Then I checked my account and I saw the order I placed the first time, when I had not entered a password!


That's strange because I did the same thing and only saw the order that was placed with the password. The first order was not shown. The first order was placed with a different customer_id, so it shouldn't be seen in the second account.

Are you sure about this??
15 Dec 2006, 10:20
#12
craftzombie avatar

craftzombie

Zen Follower

Join Date:
Jul 2006
Posts:
494
Plugin Contributions:
0

Re: bypassing create account success with empty cart

more testing..............

customer checks out with a password.
customer comes back with same email and checks out with new password
--------------------------------------------------------------------------------------

If they login with either password, they can only view the second order. The first one does not appear.

If they have one email and two passwords and happen to click on "forgot password", they still can only view the second order when they enter their temporary password.

If they happen to change their temp password to the password they entered on the first order, they still can only view the second order.

If they click on the link to see the detailed invoice in the order confirmation or order update emails from the 1st order, and they log in with either password, it takes them to the second order. (The link would have to be removed from all emails).

customers checks out with a password.
customer comes back and creates a new account with same email and same password
--------------------------------------------------------------------------------------

When they log in, the first order is the only order that appears. The second order is not shown.

now if this customer comes back a 3rd time and enters the same email and same password during account creation as they did the first two times (because they are too dumb to realize they could just log in), checks out, comes back and logs in, the last order they placed will be shown. This also happens with subsequent orders using the same email and password.

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

Other issues.....

- Duplictate newsletters will probably be sent out to those with duplicate accounts

- Wholesale customers would have to be made aware of the fact that they cannot create a duplicate account or they'll see different prices

- I assume duplicate account holders would be able to bypass "one coupon per customer" restrictions

I'm trying to think of everything this could mess up. I haven't used gift certs so I don't know exactly how they work and if they would be affected. If anyone can think of other issues, please post. My brain is fried. Time to go do something that requires no thinking....
15 Dec 2006, 13:44
#13
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
3

Re: bypassing create account success with empty cart

craftzombie:

That's strange because I did the same thing and only saw the order that was placed with the password. The first order was not shown. The first order was placed with a different customer_id, so it shouldn't be seen in the second account.

Are you sure about this??
No I am not. It's (very) possible I mixed up things myself (it's daytime here, and I get easily distracted at daytime :-) ).

I will do some more tests later. But I do think you really need the extra account_created (or whatever it should be called) field for several purposes.

(haven't got to reading the rest yet, but will do so later)
15 Dec 2006, 16:14
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: bypassing create account success with empty cart

To interject a thought ... if someone purchases a virtual product from your shop they will *need* a password in order to come back and download their goods if they don't successfully download from the checkout_success page.

Not sure if you're selling any virtual goods, but thought I'd mention it just in case...
15 Dec 2006, 19:01
#15
craftzombie avatar

craftzombie

Zen Follower

Join Date:
Jul 2006
Posts:
494
Plugin Contributions:
0

Re: bypassing create account success with empty cart

DrByte:

To interject a thought ... if someone purchases a virtual product from your shop they will *need* a password in order to come back and download their goods if they don't successfully download from the checkout_success page.

Not sure if you're selling any virtual goods, but thought I'd mention it just in case...


Please DrByte, interject as many thoughts as you can on the subject....

No virtual products here. And I don't really need to use gift certs either
(in case that would be affected). My items are small and inexpensive. I do have a few customers who purchase a large quantity and I have one wholesale customer at the moment, but I think most people just want to get in and get out. Someone in another thread mentioned that we obviously don't want repeat customers if we don't want them to sign up. But I don't think not signing up means they won't shop again. I think once you woo them with your prodcuts and fast shipping, they'd be more likely to come back a second time and then sign up.

I could just leave the password as optional and turn the email validation back on and I wouldn't have to worry about any of this. I would just delete those without a password once their order was shipped. But it would be nice to be able to see in the admin who entered a password and who didn't, so I'm going to look into that. There are other things to look into as well.

This whole thing has been a wonderful learning experience for me. I wish I knew PHP! I wish I had time to learn it!
15 Dec 2006, 19:17
#16
craftzombie avatar

craftzombie

Zen Follower

Join Date:
Jul 2006
Posts:
494
Plugin Contributions:
0

Re: bypassing create account success with empty cart

craftzombie:

But it would be nice to be able to see in the admin who entered a password and who didn't


Oops, I forgot that when they don't enter a password, a temp password is being entered into the database, so I wouldn't be able to see who entered one and who didn't.
15 Dec 2006, 21:50
#17
craftzombie avatar

craftzombie

Zen Follower

Join Date:
Jul 2006
Posts:
494
Plugin Contributions:
0

Re: bypassing create account success with empty cart

I'm debating what to do out of these four:

1. Keeping Zen exactly the way it is, leaving the password alone. (But I think I am losing customers this way)

2. Removing login/accounts for retail customers and using it only for wholesale customers.

3. Turning email validation back on and using the optional password the way PaulM intended it, where the customer can click on lost password if they decide to keep an account. The only reason I stopped validating the email was because if they place another order, they'd get the duplicate email error and might get confused (even with a note).

4.

paulm:

A solution could be to let the customers choose if they want to create an account, and add a field to the customers table which stores this preference ("account_created"). And then check for this "account_created" field when a customers uses the same e-mail address a second time.


I like #4 and #2. If there is anyone who knows how to do #4 and it isn't a big pain in the butt, let me know and I may bribe you to become my php slave.

If I can't get #4, then I think I may go with 2. I still have to do a lot of thinking about this though......

So if you read all of these posts, sorry they were so loooooooooooong. I'll shut up now!
16 Dec 2006, 10:17
#18
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
3

Re: bypassing create account success with empty cart

At account creation it's easy to detect if they have entered a password or not, and use that to set the "account created flag". Or you could add a check box to the form and make the password obligatory when it's checked and use that to set the "account created flag".

(
By itslef it's not difficult to programm parts of code, but making it a real *reliable* PWA system, in a way the customers understand what's happening, and adjust the admin files to make it practical for the shopowner, and make sure it works well under all circumstances, would take a lot of time I think....
)
16 Dec 2006, 10:40
#19
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
3

Re: bypassing create account success with empty cart

Can you try to add this to your database (when using phpMyAdmin add the table prefix if needed, or use the Zen sql tool):
ALTER TABLE `customers` ADD `customers_account_status` INT( 1 ) NOT NULL DEFAULT '1' AFTER `customers_password` ;


(backup first of course, and also I don't recommend anything I post here to use on a live shop ;-) )

And edit includes/modules/YOUR_TEMPLATE/create_account.php to change this part:
  if ($error == true) {
    // hook notifier class
    $zco_notifier->notify('NOTIFY_FAILURE_DURING_CREATE_ACCOUNT');
  } else {
    $sql_data_array = array('customers_firstname' => $firstname,
                            'customers_lastname' => $lastname,
                            'customers_email_address' => $email_address,
                            'customers_nick' => $nick,
                            'customers_telephone' => $telephone,
                            'customers_fax' => $fax,
                            'customers_newsletter' => $newsletter,
                            'customers_email_format' => $email_format,
                            'customers_default_address_id' => '0',
                            'customers_password' => zen_encrypt_password($password),
                            'customers_authorization' => CUSTOMERS_APPROVAL_AUTHORIZATION
    );


To read:
  if(empty($password)){
   $account_status = '0';
  }else{
    $account_status = '1';
  }
    
  if ($error == true) {
    // hook notifier class
    $zco_notifier->notify('NOTIFY_FAILURE_DURING_CREATE_ACCOUNT');
  } else {
    $sql_data_array = array('customers_firstname' => $firstname,
                            'customers_lastname' => $lastname,
                            'customers_email_address' => $email_address,
                            'customers_nick' => $nick,
                            'customers_telephone' => $telephone,
                            'customers_fax' => $fax,
                            'customers_newsletter' => $newsletter,
                            'customers_email_format' => $email_format,
                            'customers_default_address_id' => '0',
                            'customers_password' => zen_encrypt_password($password),
                            'customers_account_status' => $account_status,
                            'customers_authorization' => CUSTOMERS_APPROVAL_AUTHORIZATION
    );


(
= adding:
  if(empty($password)){
   $account_status = '0';
  }else{
    $account_status = '1';
  }

and:
                            'customers_account_status' => $account_status,

)

Also note that this only works when the password has already been made optional! And it's totally untested!


The idea is that when a password has not been entered, the customers_account_status will be '0', and if a valid password has been enterd it will be '1', I hope .... :-)
21 Feb 2007, 06:26
#20
usernamenone avatar

usernamenone

Totally Zenned

Join Date:
Sep 2006
Posts:
541
Plugin Contributions:
0

Re: bypassing create account success with empty cart

Has anyone tested the above code?

This is what I am looking for, remove the password and remove all login then have the link in the shopping cart go directly to create_account.php and change the wording on that page.


And yes, we have all heard from those of you who like the account thing and that if we can't wait until this come out in future Zen..........

but in the mean time those of us that love Zen Cart except for the check out steps it would be nice if we can try to clean up the check out to our needs without flack.

So over the next week I will be hacking code and crashing carts until I figure out a way to get rid of the required password and move on through checkout with the order setting in admin.

After all this is how some contributions were created.