I want to create a shopping cart for myself. In each step they can add products to the cart, apply coupon etc.. The items on cart were sessioned when taking each step of cart. Finally an array of cart info were sessioned. After login that array was inserted into db as an order then pay. I had problem that after adding items to my cart, on last step if I had not an account, first I had to create an account and when login, sometimes that array session was cleaned and I had to repeat ordering on cart again. So on last step of cart, I did serialize the array and save it to db, after login it checks if the user has a cart session in db, it generates an order for him. Now I want to improve it a better way, can you suggest how would you implement a cart?