Don't hit the add_to_cart button multiple times. Just hit it once.
Imagine a fast customer who knows you webshop very well and wants to buy for example 10 different products. So this customer will navigate through your site and drop the products in the cart really fast. He will not wait for finishing the page load as soon as he notice the add_to_cart button he will click it (once). And he will be redirected to the shopping cart always but sometimes the selected product will not be there.
And this behavior is because php sometimes doesn't save the session when it use the header function to redirect. Maybe it has no time for it and maybe itt happens on overloaded servers more often, I don't know. The fact is that I could reproduce this problem both on my pc (php 5.2.3) and on the server (php 5.2.8) where my webshop runs.
All in all it is a known php problem (google for it) and you can solve it by calling the session_regenerate_id() function before the call of the header() function.
More precisely: search for zen_redirect() in ../includes/functions/functions_general.php and make the modification below.
Code:
function zen_redirect($url) {
global $request_type;
// Are we loading an SSL page?
if ( (ENABLE_SSL == true) && ($request_type == 'SSL') ) {
// yes, but a NONSSL url was supplied
if (substr($url, 0, strlen(HTTP_SERVER . DIR_WS_CATALOG)) == HTTP_SERVER . DIR_WS_CATALOG) {
// So, change it to SSL, based on site's configuration for SSL
$url = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . substr($url, strlen(HTTP_SERVER . DIR_WS_CATALOG));
}
}
// clean up URL before executing it
while (strstr($url, '&&')) $url = str_replace('&&', '&', $url);
while (strstr($url, '&&')) $url = str_replace('&&', '&', $url);
// header locates should not have the & in the address it breaks things
while (strstr($url, '&')) $url = str_replace('&', '&', $url);
session_regenerate_id(true);
header('Location: ' . $url);
zen_exit();
}