close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Product not adding to Cart

Thread began 7/06/2009 11:21 am by bjgarner241692 | Last modified 10/09/2009 4:29 pm by Ray Borduin | 2201 views | 12 replies |

bjgarner241692

Product not adding to Cart

I'm stumped.
I am moving a clients site from another server to my own.
I exported the MySQL db to XML and imported it into the new server db.
I took an exact copy of all files and uploaded it.
I edited the connection string to use the new information.

Product displays fine on listings page.
Product displays fine on details page.
Admin pages work. I can add, remove, update product no problem.

When I click Add to Cart, I am redirected to the correct cart page but it shows. The cart is empty.

I've replaced the Add to Cart functions.
I've replaced the Cart page.

Nothing changes. No error, just an empty cart.
Both servers support the same versions of PHP (5.)

Anyone have an idea of where to start?

Sign in to reply to this post

Ray BorduinWebAssist

Try adding:

session_commit();

before the location("header: "...

function call which redirects. Sometimes the server has a bug that will prevent sessions from being set unless committed explicitly, which isn't usualy necessary.

Sign in to reply to this post

bjgarner241692

Thanks, but I cannot locate "header: " in any document on the site.

Also, my server has several WAeCart's running just fine in php and asp.

I'd like to try this, but I do not see where to insert the instruction.

Sign in to reply to this post

Ray BorduinWebAssist

On your add to cart page...

You should be able to see the redirect code right before the open <html> tag.

That is where you would add it... sorry my dyslexia... it should be:

header("location...


;)

Sign in to reply to this post

bjgarner241692

OK, I found this on each of the cart related pages:

<?php
// WA eCart Redirect
if ($eCart1->redirStr != "") {
header("Location: ".$eCart1->redirStr);
}

I changed it to this on the ordering page and it now works.

<?php
// WA eCart Redirect
session_commit();
if ($eCart1->redirStr != "") {
header("Location: ".$eCart1->redirStr);
}

I have left the cart, checkout etc. pages as they were.

I am curious how this could happen as I have other sites on the same server that do not have session_commit(); in them.

Sign in to reply to this post

Ray BorduinWebAssist

There is probably another error on the page causing the problem. I'd have to debug it to see... maybe a blank line or space in the code somewhere above the redirect.

Sign in to reply to this post

bjgarner241692

There was a blank line earlier in the document that seems to have been the problem.

That would not have been an issue in ASP. I'll have to watch for that.

Thanks

Sign in to reply to this post

bjgarner241692

I had the same problem again.
Will this be addressed in a future release?

Sign in to reply to this post

Ray BorduinWebAssist

Where are the lines in question. If you report errors with line numbers they will be corrected. The only ones we wouldn't correct would be ones we haven't found.

Sign in to reply to this post

bjgarner241692

<?php
//WA eCart Include
require_once("WA_eCart/eCart1_PHP.php");
?>
<?php
$eCart1->GetContent();
?>
<?php require_once('Connections/zeoconn.php'); ?>
<?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;
}
}
?>
<?php
$param_prod = "-1";
if (isset($_GET["ID"])) {
$param_prod = (get_magic_quotes_gpc()) ? $_GET["ID"] : addslashes($_GET["ID"]);
}
mysql_select_db($database_zeoconn, $zeoconn);
$query_prod = sprintf("SELECT * FROM store_prods WHERE ID = %s", GetSQLValueString($param_prod, "int"));
$prod = mysql_query($query_prod, $zeoconn) or die(mysql_error());
$row_prod = mysql_fetch_assoc($prod);
$totalRows_prod = mysql_num_rows($prod);
?>
<?php
// WA eCart AddToCart
if (isset($_POST["eCart1_1_ATC"]) || isset($_POST["eCart1_1_ATC_x"])) {
$ATC_itemID = $_POST["eCart1_1_ID_Add"];
$ATC_AddIfIn = 0;
$ATC_RedirectAfter = "cart.php";
$ATC_RedirectIfIn = "cart.php";
if (isset($totalRows_prod) && $totalRows_prod > 0) {
$row_prod = WAEC_findRecordMySQL($prod, "ID", $ATC_itemID);
if ($row_prod) {
$ATC_itemName = "".$row_prod['Name'] ."";// column binding
$ATC_itemDescription = "".$row_prod['ProdSize'] ."";// column binding
$ATC_itemWeight = floatval("0");// column binding
$ATC_itemQuantity = "".$_POST["eCart1_1_Quantity_Add"] ."";// column binding
$ATC_itemPrice = floatval("".$row_prod['ProdPrice'] ."");// column binding
mysql_data_seek($prod, 0);
$row_prod = mysql_fetch_assoc($prod);
}
}
$ATC_itemQuantity = floatval($ATC_itemQuantity);
if (is_numeric($ATC_itemQuantity) && $ATC_itemQuantity != 0) {
$eCart1->AddToCart($ATC_AddIfIn, $ATC_RedirectIfIn, $ATC_itemID, $ATC_itemName, $ATC_itemDescription, $ATC_itemWeight, $ATC_itemQuantity, $ATC_itemPrice);
if ($ATC_RedirectAfter != "" && $eCart1->redirStr == "") {
$eCart1->redirStr = $ATC_RedirectAfter;
}
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "") {
$_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
}
else {
$_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF'];
}
}
}
?>
<?php
// WA eCart Redirect
session_commit();
if ($eCart1->redirStr != "") {
header("Location: ".$eCart1->redirStr);
}
?>

This would not work until I added session_commit(); just after // WA eCart Redirect
All of the code is straight out of the WA tools.

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