PHP Shopping Cart Script - When to empty cart?
- by john
Im working on a shopping cart script in php and need some advice on how to handle the final process.
Once the customer has entered items into the cart, chosen shipping option, and then clicked the checkout button, they are then redirected to a paypal button which is dynamically generated using BMCreateButton.
My question is, when is the best time to empty the customers cart?
I have set up the auto return feature on paypal, which i was goin to use to then empty the cart, but its not very good as customers have to click a link in order to redirect.
So should i empty it when they click the checkout button just before the dynamic button?
I can also use these setting in php to prevent cach back button issues
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
// HTTP/1.0
header("Pragma: no-cache");
What would to guys recommend?
cheers.