Cookies? :P
Sounds like alot of work for nothing, and it sounds like it don't work either.
Appearantly, you'll need a database anyways; to store items, orders, users etc. So why use cookies to store a shopping cart, when you can use the database, which is way more secure, reliable and easier to manage.
You will need a database that looks like this :
table users
ID unsigned int increment 1 Primary Key
name
email
etc...
order
ID unsigned int increment 1 Primary Key
userID unsigned int
orderitems
OrderID unsigned int Primary Key
itemID unsigned int Primary Key
count unsigned int
item
ID unsigned int increment 1 Primary Key
title
price
etc.
Users is connected to order, which is connected to orderitems, which is connected to item. Many OrderItems can contain many Items, this is usually called a "many-to-many relation". The order table will become your shopping cart.