Jump to content

Help! Needed - Mysql temporary id


triskt17

Recommended Posts

I have an online store and I want to have a page where a guest can log in without having to register as a returning customer. I've been told I need to write some code where I put temporary information into mysql and then write code to erase that information when the order is processed. The problem is I have no idea where to start! All my orders are referenced by customer ID. Can someone please help me?

Link to comment
Share on other sites

Are you saying that guests can confirm purchase information? If so I would change that immediately.

 

However, I assume you have a way to add the information into mysql already. If so, you have easy choices:

 

1. Delete the information when they confirm a purchase

 

or

 

2. Use cron jobs

Link to comment
Share on other sites

You may need to change the way your checkout functions. If your website is setup where you need to complete a registration form, then login before they can add to basket and proceed to checkout I would scrap that. Firstly, i'm guessing that your database design will not allow orders to be disjointed from a customer, i.e they need a customer ID.

 

I would change your website so customers are actually registered on checkout whether they are going to come back to your website or not. When they checkout the first thing you can do is ask for their email address and password. If they dont have an account i.e If they are a first time buyer they still need to enter their details for shipping, payment, etc on your website so you can capture this and register them at this point and complete the checkout. Similar to how Amazon works.

 

I would not be looking at deleting any information. What if a customer needs to print off an invoice in the future? If you have deleted their record there is no way that they can do this. Customers should always be registered, it is the order process that should be ammended.

Link to comment
Share on other sites

Thank you so much for replying! I got this template from a class I took and I am no where near a programmer and could use all the help I can get! If there was a step below newbie, that would be me.

 

So right now you can add things to the shopping cart and when you check out, then it asks if you are a returning customer or a new customer. My boss hates the fact that you have to register so is there a way to go to write some code so that i have a guest login page and it enters the same user name and password for them? And they just enter their shipping address and it emails that information to me? I do like the way amazon works, and I guess with different wording I can make it sounds I just need shipping information. I do know the current code I have references logins by email, so if they think that they are checking out as a guest, and next time try to do it again, they have to remember their password. That is encrypted in my database so if they forget it, I dont know how to get it back to them.

 

You are correct in that I have customer id's associated with all my orders and I have my database all set up for customers, orders, and products. If Im right, I think customers are the highest of the order which is where I am getting lost.

 

I am pretty nervous as to deleting things out of the database, and Im pretty sure that I would screw all that up. I appretiate your help!

Link to comment
Share on other sites

I would say on the orders table, make it possible for an order to have a NULL or 0 customer id. If so, require them to enter their order number to view the order. Link the shipping/billing table to the order number and customer id, so if no customer id you can use the order number.

Lots of websites do this. It's not that hard.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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

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.