Hello there,

I've been working on a shopping cart by following certain examples and tweaking the code here and there as needed, but this particular cart requires something similar to discount codes. This company provides free upgrades or 50% off certain items depending on weither or not the customer is enrolled in an upgrade plan. This website needs a registration/login mechanism and shopping cart, but I am not sure how this should work as far as session() is concerned.

Can you have two different sessions running concurrently, one for the login and one for the cart (data in the cart stored temporarily)?

Are there any known caveats to this type of system?

I'm looking to see from an experienced PHP developer if there is a better or alternative method to use for authenticating users who are part of this plan before shopping.

8 Years
Discussion Span
Last Post by ShawnCplus

$_SESSION is an array, you can use two separate indexes for user authentication and the cart ie., $_SESSION['user'] for the login and $_SESSION['cart'] for the cart. With sessions this is usually called namespacing if you want to research it on your own.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.