close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How do I destroy the internal eCart Session?

Thread began 8/22/2017 12:27 pm by info4753 | Last modified 9/12/2017 1:45 pm by Ray Borduin | 86 views | 10 replies |

info4753

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

Sign in to reply to this post

Ray BorduinWebAssist

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.

Sign in to reply to this post

info4753

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

Sign in to reply to this post

Ray BorduinWebAssist

To generate an entirely new session use:

session_regenerate_id()

Sign in to reply to this post

info4753

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?

Sign in to reply to this post

Ray BorduinWebAssist

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.

Sign in to reply to this post

info4753

Thanks Ray!

Sign in to reply to this post

danielsebas

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

Sign in to reply to this post

Ray BorduinWebAssist

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.

Sign in to reply to this post

danielsebas

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

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

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.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...