close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Fatal error: Call to a member function ClearCart

Thread began 10/30/2009 7:11 am by tim.wolak331163 | Last modified 10/30/2009 4:20 pm by Jason Byrnes | 1399 views | 7 replies |

tim.wolak331163

Fatal error: Call to a member function ClearCart

For some reason on the checkout success page I'm getting this error at the bottom of the page.

Fatal error: Call to a member function ClearCart() on a non-object

How do I fix this and what is the best way to clear a session after the user checks out?

Thanks,
Tim

Sign in to reply to this post

Jason ByrnesWebAssist

Most likely, the success page is missing the require_once line to attach the cart include file, but I cant say for sure without seeing the code.

make sure code similar to the following is at the top of your page:
<?php
//WA eCart Include
require_once("WA_eCart/$<Cart Name>_PHP.php");
?>
<?php
$<Cart Name>->GetContent();
?>


Where <Cart Name> is the name of your eCart object.


To clear a session variable add :
<?php if($_SESSION['variable_name']) unset($_SESSION['variable_name']); ?>

Sign in to reply to this post

tim.wolak331163

Here is the page, please let me know what you find.

Sign in to reply to this post

tim.wolak331163

<?php
//WA eCart Include
require_once("WA_eCart/BNB_PHP.php");
?><?php
$BNB->GetContent();
?>
<?php
if ($BNB->IsEmpty()) {
$BNB->redirStr = "bnb-cart.php";
$BNB->cartAction = "RedirectIfEmpty";
}
?>
<?php
// WA eCart Redirect
if ($BNB->redirStr != "") {
header("Location: ".$BNB->redirStr);
}
?>
<p class="eC_SmallPrint">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>

</div><!-- InstanceEndEditable --></div> <!-- content div end -->

</div> <!-- wrapper div end -->
<div id="footer">

</div> <!-- footBar div end -->
</body>
<!-- InstanceEnd --></html>

<?php
// Clear carts contents
$eCart1->ClearCart();
$_SESSION['clientsID'] = '';
$_SESSION['orderID'] = '';
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]);
}
}
}
?>

Sign in to reply to this post

tim.wolak331163

Strange also I'm seeing a lot of the same order numbers and the sessions are not ending. Any ideas?

Thanks,
Tim

Sign in to reply to this post

Jason ByrnesWebAssist

The code to clear the cart:
$eCart1->ClearCart();

is using a cart named eCart1, your cart is named BNB. the code should be:

$BNB->ClearCart();



Try using this code instead:

php:
<?php

// Initialize the session.
// If you are using session_name("something"), don't forget it now!
@session_start();

// Unset all of the session variables.
$_SESSION = array();

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (isset($_COOKIE[session_name()])) {
    @
setcookie(session_name(), ''time()-42000'/');
}

// Finally, destroy the session.
session_destroy();
?>
Sign in to reply to this post

tim.wolak331163

Thanks Jason, I will put that code in for sure. Any reason I would be seeing duplicate order numbers? If the sessions are not ending is that why I would be seeing things like my shipping quotes not changing when a user adds more items with more weight?

Thanks,
Tim

Sign in to reply to this post

Jason ByrnesWebAssist

The order numbers are based on the session, if the session does not end, it will use the same order number.


The shipping is calculated when the checkout page posts to the confirm page.


If the user goes back and enters more items, the shipping will not be re calculated until they go through the checkout page again.

Sign in to reply to this post

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...