How do I destroy the internal eCart Session?
Each time I'm making an order without closing the browser I'm getting the same reference ID. How do I destroy the internal session of the ecart? What is its name? Thanks
Each time I'm making an order without closing the browser I'm getting the same reference ID. How do I destroy the internal session of the ecart? What is its name? Thanks
It is whatever you have it set as in the Store Cart Summary in Database server behavior. It has a default of OrderID I think, but check the confirm.php page to be sure.
Hi Ray
Thanks for your fast reply. I do have the OrderID in a session (Bestellnummer) but there is another session fromthe eCart that generates a OrderReferenceID: session_id() . And this session is always alive for the ecart. How can I remove it after finishing the order?
<?php
// WA eCart Store Cart Summary in MySQLi Db
if (isset($_POST["BestellungBtn"]) || isset($_POST["BestellungBtn_x"])) {
$ConditionalQuery = new WA_MySQLi_Query($ullri_2015_i);
$ConditionalQuery->Action = "conditional";
$ConditionalQuery->Table = "orders";
$ConditionalQuery->saveInSession("Bestellnummer");
$ConditionalGoTo = "";
if (function_exists("rel2abs")) $ConditionalGoTo = $ConditionalGoTo?rel2abs($ConditionalGoTo,dirname(__FILE__)):"";
$ConditionalQuery->redirect($ConditionalGoTo);
if (isset($_SESSION[$ConditionalQuery->SaveAs])) $ConditionalQuery->addFilter("OrderID", "=", "d", $_SESSION[$ConditionalQuery->SaveAs]);
$ConditionalQuery->bindColumn("OrderReferenceID", "s", "".session_id() ."", "WA_DEFAULT");
$ConditionalQuery->bindColumn("OrderSubtotal", "d", "".$eCartUllrich->TotalColumn("TotalPrice") ."", "WA_DEFAULT");
...
It's the ecart > [Session ID] that can be selected in the server entity panel
To generate an entirely new session use:
session_regenerate_id()
I don't need to recreate it, it need to destroy the session of the ecart that can be accessed via the UI ([Session ID]). What is the name of this session?
session_id() is not a variable in the session. It is the identifier for the session itself. You can't access it directly you would have to start a new session.
If you use:
session_regenerate_id(true);
That will completely remove the old session and all of it's contents when starting a new session. There is no such thing as ending a session and continuing to be on the website without a session_id() set. The only option is to generate a new one and start a new session so that it will have a new value.
Hi Ray, I am using eCart to only generate orders of my self business, but I have to make orders for different clients but I cannot do that because the order table is updated every time I try to enter a new order and the cart is not cleared.
In the cart instead of using the display wizard I just triggered the eCart summary and detail store behaviors with the checkout button and in the landing page that would be success.php I cleared all sessions and put the code:
<?php session_regenerate_id(true); ?>
But the session is not cleared, what can I do to clear the session and start over?
Thank you.
Regards,
Daniel
To get a new order into the database, all you have to do is clear the one session variable used to store the orderID set in the Save Cart Summary in Database server behavior like:
unset($_SESSION['OrderID']);
Check the Store Cart Summary in Database server behavior to make sure that you are using OrderID as your session variable name.
Thank you Ray, it worked, but that session does not appear in the bindings tab. The name of the Order ID is pedidoID, I just put it in the list of unset sessions.
<?php
@session_start();
if ("" == ""){
// WA_ClearSession
$clearAll = FALSE;
$clearThese = explode(",","captcha_Security_Code_1,ingreso_producto_imagen,comID,inventarioID,egresoCOMID,INVID,egresoID,undefined_ingresar_cliente,WADbSearch1_ingresar_cliente,clienteID,PRODID,undefined_ingresar_pedido,WADbSearch1_ingresar_pedido,session_id,pedidoID");
if($clearAll){
foreach ($_SESSION as $key => $value){
unset($_SESSION[$key]);
}
}
else{
foreach($clearThese as $value){
unset($_SESSION[$value]);
}
}
}
?>
I Also have some sessions that start with undefined that where created when I was configuring WA search, but I don't think they affect anything.
I manage to clear the cart contents in the landing page by adding this code:
<?php
//WA eCart Include
require_once("../WA_eCart/eCartPedidos_PHP.php");
?>
<?php
$eCartPedidos->GetContent();
?>
<?php
// WA eCart Trigger Clear Cart
if ("" == "") {
$eCartPedidos->ClearCart();
$Redirect_redirStr="";
if ($Redirect_redirStr != "") {
$eCartPedidos->redirStr = $Redirect_redirStr;
}
$eCartPedidos->cartAction = "ClearCart";
}
?>
I had to put it manually because the server behavior for clear cart is not working properly in my computer, I'm attaching an image.
Regards,
Daniel
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.