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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.