The best method is not the most easy one. I have a lot of expierience with shopping carts, and i think the best method is to give your users a unique ID (like a random number+their IP adres) this is set in a table. Every time someone visits the site, you delete previous id's and cartitems.
Build up each page with the ID in the url (so when they go to i.e. the checkout it something like "http://cart.com/checkout?id=121545412.119.232.2" with this variable no users need to log in, but everyone has it's unique ID code true their shopping process. if someone leaves the site early , no data is kept.
Here's an example of giving id's in your index.php . you need to modify you mysql tables for use with a userid
if ($UID != "") {
$result=mysql("$DBName","SELECT * FROM Users WHERE User='$UID'");
$num=mysql_num_rows($result);
if ($num == "0") {
$dt=date("YmdHis");
$UID="$dt$REMOTE_ADDR";
$date=date("z");
mysql("$DBName","INSERT INTO Users VALUES ('$UID','$date')");
Header("Location: $PHP_SELF?UID=$UID");
}
}
I hope i helped you out in a way..
Greetingz!
Johan