Click here to Skip to main content
15,113,531 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi,

i want to make a shopping cart in which user visit my site and add item to cart and can delete items from cart and when user go for checkout then we ask for login.

my question is that how to manage visited user a unique id to do above operation
and also if user leave the website then its cart should be blanked.

thank you,
Posted
Comments
Vani Kulkarni 12-Jul-12 5:31am
   
What have you tried till now? Do you have any code? If yes, please post it. This is a huge question to answer and even vague too. Please be specific.
rajesh@1989 12-Jul-12 5:34am
   
i do not have any code for that i just ask how to manage it
rajesh@1989 12-Jul-12 5:38am
   
just tell me that how to create session id for specific user who are visited my site. my reference site is www.4templates.com

1 solution

just tell me that how to create session id for specific user who are visited my site
Ok. Here is the logic:
If you are giving a shopping cart feature to buy stuff, you have to register user in order to track all the details properly. Information helps throughout the existence of that user and not just for a session.
You need to ask user to register before buying/payment. You will capture necessary details like name, address, username, password. You need to make sure that the username is unique for your database. Once this is in place, you can always track a particular user easily along with the items in the cart.

Things can be added to this specific user cart. It's user discretion to keep or remove at the time of logging out or buying any other stuff from your website.


Now, apply it!
   
Comments
rajesh@1989 12-Jul-12 5:54am
   
thank you,

have a look to www.4templates.com site. here user has not to registered himself before buying. He can add items to cart without login and if he want to checkout/payment for that then he need to login.
I want to do same operation like www.4templates.com
Sandeep Mewara 12-Jul-12 7:30am
   
Use GUID in a session for that particular session as long as user is not logged in. This will keep unique session for that time and once user logs in, transfer the content to usrename.

Though, I would suggest you to ask user to login in order to add things to cart.
rajesh@1989 12-Jul-12 7:35am
   
how to use GUID? please suggest me any example for it.
Sandeep Mewara 12-Jul-12 7:43am
   
Guid g = Guid.NewGuid();

Refer:http://msdn.microsoft.com/en-us/library/system.guid.newguid.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900