close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Checkout success page immediately forwarded to cart page

Thread began 1/11/2011 8:40 am by henrik.schlegel400884 | Last modified 1/12/2011 6:05 pm by henrik.schlegel400884 | 1898 views | 10 replies

Henrik

Checkout success page immediately forwarded to cart page

When testing my site I have found that the checkout process with Paypal works sometimes well, sometimes not.

If it works not the problem is if a user confirms an order on the confirm page he is redirected to the cart page. The order is successfully placed and appears in the database - the URL of the checkout success page shows up for a second BUT is forwarded immediately to the cart page.

As I said this problem shows up only sometimes -
other times it works just fine.

The problem seems particularly to show up on Windows using Firefox.
On a Mac using Safari and Firefox I didn't had this problem.

Here is the php code of my pp_checkout_success page.
If someone could detect that issue, I would happy to know!
Thanks!

Top of page:

<?php
//WA eCart Include
require_once("../../WA_eCart/eCart_en_PHP.php");
?>
<?php require_once('../../Connections/mysql_--removed--.php'); ?>
<?php
$eCart_en->GetContent();
?>
<?php
require_once("../../WA_eCart/PP_ECO_Scripts/PP_ECO_PHP.php");
?>
<?php require_once( "../../WA_SecurityAssist/Helper_PHP.php" ); ?>
<?php
$WA_PP_ECO_GetResult = WA_PP_ECO_SOAPObject();
if ((isset($_GET["token"]) && isset($_GET["PayerID"])) || (isset($_SESSION["PayPal_ECO_Token"]) && $_SESSION["PayPal_ECO_Token"] != "")) {
$WA_PP_ECO_GetResult = WA_PP_ECO_Get_Post("--removed--", "--removed--", "--removed--", false);
}
?>
<?php
if (!WA_Auth_RulePasses("Logged in to users")){
WA_Auth_RestrictAccess("users_LogIn.php");
}

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$colname_pp_check_succ_users = "-1";
if (isset($_SESSION['UserID'])) {
$colname_pp_check_succ_users = (get_magic_quotes_gpc()) ? $_SESSION['UserID'] : addslashes($_SESSION['UserID']);
}
mysql_select_db($database_mysql_--removed--, $mysql_--removed--);
$query_pp_check_succ_users = sprintf("SELECT * FROM users WHERE UserID = %s", GetSQLValueString($colname_pp_check_succ_users, "int"));
$pp_check_succ_users = mysql_query($query_pp_check_succ_users, $mysql_--removed--) or die(mysql_error());
$row_pp_check_succ_users = mysql_fetch_assoc($pp_check_succ_users);
$totalRows_pp_check_succ_users = mysql_num_rows($pp_check_succ_users);

$paramUserID_rsDownloadCount = "-1";
if (isset($_SESSION['UserID'])) {
$paramUserID_rsDownloadCount = (get_magic_quotes_gpc()) ? $_SESSION['UserID'] : addslashes($_SESSION['UserID']);
}
mysql_select_db($database_mysql_--removed--, $mysql_--removed--);
$query_rsDownloadCount = sprintf("SELECT COUNT(products.ProductLocation) AS DownloadCount FROM orders INNER JOIN orderdetails on orders.OrderID = orderdetails.DetailOrderID INNER JOIN products on orderdetails.DetailProductID = products.ProductID WHERE orders.OrderUserID = %s", GetSQLValueString($paramUserID_rsDownloadCount, "int"));
$rsDownloadCount = mysql_query($query_rsDownloadCount, $mysql_--removed--) or die(mysql_error());
$row_rsDownloadCount = mysql_fetch_assoc($rsDownloadCount);
$totalRows_rsDownloadCount = mysql_num_rows($rsDownloadCount);
?>
<?php
if ($eCart_en->IsEmpty()) {
$eCart_en->redirStr = "cart_en.php";
$eCart_en->cartAction = "RedirectIfEmpty";
}
?>
<?php
// WA eCart Redirect
if ($eCart_en->redirStr != "") {
header("Location: ".$eCart_en->redirStr);
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


Bottom of page:

<?php
mysql_free_result($pp_check_succ_users);

mysql_free_result($rsDownloadCount);
?>
<!-- CLEAR CART SESSIONS -->
<?php
// Initialize the session.
// If you are using session_name("something"), don't forget it now!
@session_start();

//store the user session
$userSession = $_SESSION['UserID'];

// 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 (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
@setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}

// Finally, destroy the session.
session_destroy();
unset($_SESSION);
@session_start();
@session_regenerate_id();


//reset user session
$_SESSION['UserID'] = $userSession;
?>

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