If the user has some items in cart and the session expires, then the user comes back and the cart contents are restored using the cookie, if he/she tries to checkout as a guest, the following check fails:
if (isset($_SESSION['cart']->cartID)) {
if (!isset($_SESSION['cartID']) || $_SESSION['cart']->cartID != $_SESSION['cartID']) {
$_SESSION['cartID'] = $_SESSION['cart']->cartID;
}
} else {
zen_redirect(zen_href_link(FILENAME_TIME_OUT));
}
thus he/she is always redirected to the timeout page.
In fact the cartID is not set by the observer class after restoring the cart contents, unlike e.g. the restore_contents() function of the shopping cart (called after a registered user logs in):
Adding this line in the constructor of the class.savecart.php, inside and at the end of the condition if ($hash_key === $_COOKIE['cartkey']) {, solved the issue for me:
If the user has some items in cart and the session expires, then the user comes back and the cart contents are restored using the cookie, if he/she tries to checkout as a guest, the following check fails:
thus he/she is always redirected to the timeout page.
In fact the
cartID
is not set by the observer class after restoring the cart contents, unlike e.g. therestore_contents()
function of the shopping cart (called after a registered user logs in):Adding this line in the constructor of the
class.savecart.php
, inside and at the end of the conditionif ($hash_key === $_COOKIE['cartkey']) {
, solved the issue for me: