Clear cart clears everything or nothing
When I add the clear session values to my page I can get it to clear everything by checking the box to "clear all sessions". However, if I select only the cart items in the window nothing gets cleared.
When looking through the forums i came across a similar issue and tried adding the suggestions to save and and restore so my code now looks like this.
<?php
$loginUsername = $_SESSION['user_name'];
$password = $_SESSION['pass_word']
?>
<?php
@session_start();
if ("" == ""){
// WA_ClearSession
$clearAll = TRUE;
$clearThese = explode(",","");
if($clearAll){
foreach ($_SESSION as $key => $value){
unset($_SESSION[$key]);
}
}
else{
foreach($clearThese as $value){
unset($_SESSION[$value]);
}
}
}
?>
<?php session_start();
$_SESSION['user_name'] = $loginUsername;
$_SESSION['pass_word'] = $password;
?>
This however still logs me out. Am I missing something in the restoring of the username and password?
I tried simply using the clear cart function before page load but it just stalls the page for some reason.
<?php
// WA eCart Trigger Clear Cart
if ("" == "") {
$ToyoeCart->ClearCart();
$Redirect_redirStr="checkout_success.php";
if ($Redirect_redirStr != "") {
$ToyoeCart->redirStr = $Redirect_redirStr;
}
$ToyoeCart->cartAction = "ClearCart";
}
?>
<?php
// WA eCart Redirect
if ($ToyoeCart->redirStr != "") {
header("Location: ".$ToyoeCart->redirStr);
}
?>
Ideally what it needs to do is clear the cart however not clear the log in session variables so the visitor can continue to do other activities.