Welcome Guest, Not a member yet? Register   Sign In
Sessions are mandatory for my app, will that cause problems with some browsers?
#1

[eluser]Flying Fish[/eluser]
I have a simple app that allows users to order printed items like postcards, flyers, door hangers, etc.

At step one of the order process, I create an entry in my db in a table called 'orders', then I store the auto-incrementing 'order_id' of that record in the user's session. Any items they want to get are written into the db in a table called 'items' and are connected to the with the 'order_id' from the session.

I'm doing checks to make sure that the user is logged in and has an order_id, so they can't order any items without one.

My question is this, each browser has to have cookies enabled in order for sessions to work, right? Could this cause a problem, or are cookies so widespread that it's a non issue.
#2

[eluser]TheFuzzy0ne[/eluser]
Some users disable cookies, but not many, but every modern browser supports them, so if the user doesn't have them enabled, it's not because they can't, it's because they choose not to. So long as you tell the user they need cookies enabled, it's then their choice. Your app is the night club, and cookies are the dress code. If a user is logged in, then they have cookies enabled anyway.
#3

[eluser]Flying Fish[/eluser]
Thanks. Would you say that the approach I'm taking sounds about right. I don't think there's really a better way to accomplish it?

I'd say it's similar to a shopping cart concept.
#4

[eluser]TheFuzzy0ne[/eluser]
I think you've got the right idea. There's only one thing that comes to mind though. What happens if the user signs up and starts an order, but never goes through with it? Do you have some kind of cleaning mechanism to get rid of those entries in the database, or are you going to just leave the entries in there?
#5

[eluser]Flying Fish[/eluser]
As of right now, the abandoned orders just stay in there. The app's built for a very specific case, so there will never be more than 200 people ordering. Because of the limited number of users, I don't think it would be a problem.

That said, I'm thinking of dropping in a little section in my back end that says 'abandoned orders' and gives me the option to delete them.

Is there an easy way to automate the process?
#6

[eluser]TheFuzzy0ne[/eluser]
Yes. You need to decide when orders are going to be deleted, and you can have a simple method in your model called "delete_old_orders" or something similar, which can be run whenever a customer adds an item to an order. It doesn't have to be then, you can decide when you want it to run, and call it from within that function/method. You can run it whenever you want really, but a call to this method from your the model that inserts the order should do the trick. It's just a single query that will delete orders older than whatever time frame you decide.
#7

[eluser]Flying Fish[/eluser]
I'll see how things go. If I get more incomplete orders than I bargain for, I'll probably try to implement an auto-delete function. Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB