Jump to content
SaranacLake

Save items to buy

Recommended Posts

What is the best way to capture items that someone wants to purchase when they don't have an account yet?

And I prefer not using cookies.

 

 

Share this post


Link to post
Share on other sites

With the session.

You shouldn't store it in a cookie anyways.

Share this post


Link to post
Share on other sites

@requinix,

Please allow me t explain more what I'm trying to do...  (Have been out of coding LAMP for years and this is like starting allow over?!)

I am building an online newspaper/magazine where people can access mostly free content or buy a membership and get access to premium content.

Originally I was going to use a registration process like you use here: Create account/Activate account/Log in/Use site.  But after reading and speaking with people, they say that all of those steps will lead to cart abandonment, plus confuse most people.

So here is what I was trying to do...

You click on the "Subscribe" button in the menu.  I launch a page which displays a couple of membership plans (e.g. Plan-A, Plan-B-, Plan-C).  The user clicks on one of them, somehow I capture that choice, and then I take them to a "checkout" page where they would enter in there Account Details (i.e. username, email, password) and Payment Details (i.e. bank card info) and then they click "Process order".

Does that make sense?

 

 

 

Share this post


Link to post
Share on other sites

Sure - that's not exactly an uncommon thing to do. But that doesn't change my answer.

Share this post


Link to post
Share on other sites
Just now, requinix said:

Sure - that's not exactly an uncommon thing to do. But that doesn't change my answer.

So the user clicks on a member plan they want, and I stash it in the PHP session?

Can you provide a simple code xample of how that is done?

What I am not understanding - and why I explained more what I am doing - is that at this point there is no member record.

So how does the session, or how do I, keep track of all of these random strangers on my site?

 

Not to get to far ahead, but here is a related issue that I'm still not sure how to solve...

So if a person chooses the first two subscription plans that is fairly straight-forward.  However, with the thid plan they get a free book.  And this necessitates them having to navigate off of my new once-stop-checkout-page and having to navigate to the "produc catalog" where they look through all of the books and pick one out.

Because my new approach does not create an account first, it is unclear to me how I keep track of which subscription plan an unregistered user chooses, then which free book they choose from the catalog, and then how to piece all of that back together when they return to this one-stop-shop-checkout page.

Does that make sense?

 

Share this post


Link to post
Share on other sites

Yes, that does explain something I was wondering.

The session doesn't care about your members. It's just a way for you to store data about the person browsing your site. That data could include a little bit about their membership, like a user ID or name, but it doesn't have to.

You would use the session to store the subscription plan they chose. Just another piece of data you include in the session. When they hit the checkout page you'll know whether they are logged in or not (based on what you store in the session when the log in), and if they aren't you'll also know what subscription plan they selected (if they did that).

Share this post


Link to post
Share on other sites
Just now, requinix said:

Yes, that does explain something I was wondering.

The session doesn't care about your members. It's just a way for you to store data about the person browsing your site. That data could include a little bit about their membership, like a user ID or name, but it doesn't have to.

You would use the session to store the subscription plan they chose. Just another piece of data you include in the session. When they hit the checkout page you'll know whether they are logged in or not (based on what you store in the session when the log in), and if they aren't you'll also know what subscription plan they selected (if they did that).

Well, to be clear, in the scenario above, a person would never have an account so they would never be logged in.

(You would only see the "Subscribe" button if you aren't logged in, which is presumably people who don't have an account.)

 

Now some follow up uestions...

1.) If a person chooses Plan- or Plan-B and thus never leaves my one-page checkout page, then would I even need to use a session?

I mean if you are a single page that you could think of as both a Product Page and a Checout Page, couldn't I just grab whichever plan they choose as form data and leave it at that?

 

2.) If a person choose Plan-C where they get a free eBook, then they click on a "Choose my eBook" button adn I take them to the Product Catalog.  They browse through the listing of eBook, and then would presumably choose "Add to Cart" for the free eBook they want.  Now in that cae i guess I need the Session to capture which book they choose, so that when they return to the Checkout page, I have that info handy, right?

 

3.) Likewise, if a person did NOT imemdiately go to the product Catalog and choose their free eBook, and instead they started to fill out things like username, email, password, etc, then I guess i would want to store that in the Session so I dn't loose it when they leave to go pick out their free eBook? 

Hope that makes sense?

 

Share this post


Link to post
Share on other sites

The session is for tracking stuff between pages. If you get everything you need on a single page then you don't need to use the session for it, but if you need the user to browse around your site then you do need it.

With that said, for the ebook one, you should check if there is an ebook in their cart: if they don't have one you can offer them the plan and tell them to go find an ebook they want and come back (perhaps offering a selection of popular ones right there so they don't have to leave checkout), and if they do you tell them they'll get it for free. That way you don't even have to do anything extra with the session.

Share this post


Link to post
Share on other sites
Just now, requinix said:

The session is for tracking stuff between pages. If you get everything you need on a single page then you don't need to use the session for it, but if you need the user to browse around your site then you do need it.

With that said, for the ebook one, you should check if there is an ebook in their cart: if they don't have one you can offer them the plan and tell them to go find an ebook they want and come back (perhaps offering a selection of popular ones right there so they don't have to leave checkout), and if they do you tell them they'll get it for free. That way you don't even have to do anything extra with the session.

This is where I am getting confused...

In my original design, I had hoped to make people create and activate an account FIRST, and then when they were shopping or checking out, everything would be tied to a database record/user-account.

But since I have been told not to do that, it's messed up how I envision things.

When you say "shopping cart", isn't that going to be my Session or is it something else?

Below is how I was going to design this new page...

Choose a Plan:

- Plan A

- Plan B

- Plan C  (link: "Choose your free eBook")

 

Enter Account Details

- Username

- Email

- Password

 

Payment Details

- Name on Card

- CC #

- Exp Date

- CVV

 

<Process Order>

 

I'm not sure what to do when they click on the link "Choose free eBook"??

Do I take them to a new page and risk losing other details they may have entered like Username, Email, Payment Details?

Do I maybe pop-up a smaller window where they can browse for their eBook there?

Something else?

 

Also, I guess i can't store Payment Details in teh Session if they have started entering them as that would be insecure?

 

All of this this seems awkward because I am used to when you checkout you know what you want and you dn't go back and shop some more.  PLUS you already have an account set up!

 

So how do more mature ecommerce sites liek Amazon handle a case where someone is starting to check out and all of a sudden they need to go back to the prduct catalog to search for more items??

 

Share this post


Link to post
Share on other sites

A shopping cart is what happens when you store item information in the session and then present everything there to the user so they can buy everything at once.

50 minutes ago, SaranacLake said:

Do I take them to a new page and risk losing other details they may have entered like Username, Email, Payment Details?

Wouldn't be good. Make this a separate step from entering information, either before or after.

50 minutes ago, SaranacLake said:

Do I maybe pop-up a smaller window where they can browse for their eBook there?

A small popup would make it hard for the user to browse your site to find an ebook. If anything, you'd present a popup with a list of ebooks they can choose from - no browsing.

51 minutes ago, SaranacLake said:

Also, I guess i can't store Payment Details in teh Session if they have started entering them as that would be insecure?

Try not to store credit card information anywhere and only ask when you're about to perform the transaction.

53 minutes ago, SaranacLake said:

All of this this seems awkward because I am used to when you checkout you know what you want and you dn't go back and shop some more.  PLUS you already have an account set up!

Time to change how you think about it.

53 minutes ago, SaranacLake said:

So how do more mature ecommerce sites liek Amazon handle a case where someone is starting to check out and all of a sudden they need to go back to the prduct catalog to search for more items??

The user doesn't commit to anything until they finish the checkout process. Items remain in the cart until then. If they quit and go browsing again then the cart still has their items for when they're ready to hit checkout (again).

Share this post


Link to post
Share on other sites
Just now, requinix said:

The user doesn't commit to anything until they finish the checkout process. Items remain in the cart until then. If they quit and go browsing again then the cart still has their items for when they're ready to hit checkout (again).

This is one place where I am confused...

If I log into my Smazon account, add items to my shopping cart, and a transformer goes out knocking me offline all weekend, when I go back into my Amazon account on Monday, my items will be there.

If unknown-user adds items to their "shopping cart" and I store them in a PHP session, and a transformer goes out r they leave or whatever, then there is no way to link those shopping cart items back to unknown-user, right?

So if they haven't registered and I'm not associating items chosen with a database record, I don't see how there is any permanancy?

 

As far as the process flow, maybe this is where I am getting confused and where I need to tweak things...

**********

- Unregistered user clicks on "Subscribe"

- System takes them to a page showing: Plan-A, Plan-B, and Plan-C.  (This is like a page in the product catalog.)

- User chooses Plan-C and then is taken to another page in the product catalog to choose a free eBook.

- After they do this, then they should have everything in their "shopping cart" that they need, and I could show them a "Checkout" button

- User clicks on "Chekcout" and then I display a one page form asking for:

	Account Details
	Payment Details
	

 

Does that sound better?

 

 

Share this post


Link to post
Share on other sites

It sounds like you don't actually know what sessions are. How about you spend some time researching them?

Share this post


Link to post
Share on other sites
1 hour ago, requinix said:

It sounds like you don't actually know what sessions are. How about you spend some time researching them?

I'm rusty on PHP in general...

When I worked with Session in the past, they were used for Customers with Customer record in the DB and that is not what I'd be doing here.

As far as I know, when a user closes their browser the session ceases to exist, which relates to my questions above.

 

Share this post


Link to post
Share on other sites

Personally I would just let the cart empty. That's how it normally works.

If you really don't want that then store the cart in the database, using a unique identifier generated and stored in a cookie. Yes, you would have to use a cookie for this.

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.