Bind cart items to a logged in user

HI Everyone,

I have a project where I want to create a private site used for quoting new computers/monitors/keyboard etc to customers.

I want to be able to login to the website and then add items to the cart from a list of items I have prepared with set prices, supplier codes, pictures etc

Once the cart has all of the needed items then click create quote.

which sends the user to a dynamically created page with a copy and pastable quote with pictures, descriptions etc ( will work on then being able to email the quote out to the user from the website later )

Would also like for the items to stay in the cart if the user logs out untill they either remove them or click create quote.

Would like the quotes to be saved on another page where the user can browse the quotes they have created.

It sounds like a lot but I don’t believe it would be that hard to create. I’ve already created a site with working login and signup as well as a cart where i can add items. Just don’t know how to get the items to stay in the cart when the user logs out. I’m guessing I have to save them to a database table or something?

Any ideas or if someone could point me in the right direction to where i could learn to do something like this?

Kind Regards,
Andrew

Hey there!

Looks like you are well on your way to a successful project. :wink:

I would suggest you to search Google for something like: ‘Shopping cart PHP tutorial’ or something similar. I searched around, and found a few tutorials based on browser sessions: https://www.sanwebe.com/2013/06/creating-simple-shopping-cart-with-php/comment-page-1

Now, this won’t save the data after a user logout, where generally, you remove the sessions. But, I do think when you’ve gone through the tutorial, you should have a good general idea how to work with the database, and how to save, remove and update rows in tables. With a bit of effort you should be able to create your shopping cart based on DB records per user. If you do have additional questions after the tutorial, please feel free to ask them. :slight_smile:

Good luck!

Sounds like an Ecommerce site. Nothing special from what I am seeing, you are just generating a quote rather than a receipt.

Thanks mate, will give it a read :slight_smile:

Yes astoneipher, it is very similar to an eCommerce site, except i’d like to as you said generate a quote instead of a receipt, skip the payment processing, hold the quote in the user’s account until it’s accepted and then use the quote to generate an email to send to accounts for ordering.Also keep the items in the cart if the user stops half way through and needs to pick it up from another computer.

Well, assuming you are saving the current cart in a database, just use the client’s ID number to store the cart in the database under. Then, when he/she logs back into the site, it can look for any unfinished carts and note them so the client can review, add to them or delete them. Should not be hard to sort that out. Just create a table with the user’s ID and cart number and the cart itself. Let us know how it goes…

I would look into Magento, personally. And see what extensions exist. I don’t think what you are working on is that out of the ordinary.

Sponsor our Newsletter | Privacy Policy | Terms of Service