Clears Cart (sort of)
Thanks for the tip but I must be doing something wrong.
I am using the checkout process that was created with the eCart 5 wizard. There is no payment gateway, this is just a TakeOut order process for a customer to collect and pay at the shop.
So I am putting the code you suggest in the checkout_success.php page which is basically the 'Thank you for your order' message.
From your post I assume I had to add a session which I did with a name ClearCartSession.
This is what I added before the doctype:
<?php
//WA eCart Include
require_once("../WA_eCart/CustomerCart_PHP.php");
?>
<?php require_once('../Connections/testDB.php'); ?>
<?php
$CustomerCart->GetContent();
?>
<?php
if (!session_id()) session_start();
if(!isset($_SESSION["ClearCartSession"])) {
$_SESSION["ClearCartSession"] = "";
}
?>
I am using a template so I put the unset part after the body but before the closing html tag:
<?php
$CustomerCart->ClearCart();
unset($_SESSION['ClearCartSession']);
?>
</html>
On testing the process, the order gets added to the database, the email is sent and the cart appears empty. So far so good.
HOWEVER,
If I create another order, everything processes as expected but the previous order is replaced in the database with the new order instead of being added as a new order.
Any idea what I am doing wrong?
Paul