close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Cart is empty intermittently

Thread began 12/08/2009 2:34 pm by wbrooks199805 | Last modified 12/16/2009 9:45 am by Jason Byrnes | 3321 views | 11 replies |

wbrooks199805

Cart is empty intermittently

The weird thing, its only happening from home page with the add to cart buttons. Other pages are working. Its only happening once in a while and some people have the problem and some do not. please advise if you want to look at something else.

<?php
//WA eCart Include
require_once("WA_eCart/eCart1_PHP.php");
?>
<?php
$eCart1->GetContent();
?>
<?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 = "shopping_cart.php";
$ATC_RedirectIfIn = "";
$ATC_itemName = "BusinessWeek 50 Issues - 1 Year";// column binding
$ATC_itemDescription = "";// column binding
$ATC_itemWeight = floatval("0");// column binding
$ATC_itemQuantity = "".$_POST["eCart1_1_Quantity_Add"] ."";// column binding
$ATC_itemPrice = floatval("10.00");// column binding
$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 AddToCart
if (isset($_POST["eCart1_2_ATC"]) || isset($_POST["eCart1_2_ATC_x"])) {
$ATC_itemID = $_POST["eCart1_2_ID_Add"];
$ATC_AddIfIn = 0;
$ATC_RedirectAfter = "shopping_cart.php";
$ATC_RedirectIfIn = "";
$ATC_itemName = "Smart Money 12 Issues, 1 year";// column binding
$ATC_itemDescription = "";// column binding
$ATC_itemWeight = floatval("0");// column binding
$ATC_itemQuantity = "".$_POST["eCart1_2_Quantity_Add"] ."";// column binding
$ATC_itemPrice = floatval("5.00");// column binding
$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 AddToCart
if (isset($_POST["eCart1_3_ATC"]) || isset($_POST["eCart1_3_ATC_x"])) {
$ATC_itemID = $_POST["eCart1_3_ID_Add"];
$ATC_AddIfIn = 0;
$ATC_RedirectAfter = "shopping_cart.php";
$ATC_RedirectIfIn = "";
$ATC_itemName = "Black Enterprise 12 issues, 1 year";// column binding
$ATC_itemDescription = "";// column binding
$ATC_itemWeight = floatval("0");// column binding
$ATC_itemQuantity = "".$_POST["eCart1_3_Quantity_Add"] ."";// column binding
$ATC_itemPrice = floatval("5.00");// column binding
$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 AddToCart
if (isset($_POST["eCart1_4_ATC"]) || isset($_POST["eCart1_4_ATC_x"])) {
$ATC_itemID = $_POST["eCart1_4_ID_Add"];
$ATC_AddIfIn = 0;
$ATC_RedirectAfter = "shopping_cart.php";
$ATC_RedirectIfIn = "";
$ATC_itemName = "Entrepreneur 12 issues, 1 year";// column binding
$ATC_itemDescription = "";// column binding
$ATC_itemWeight = floatval("0");// column binding
$ATC_itemQuantity = "".$_POST["eCart1_4_Quantity_Add"] ."";// column binding
$ATC_itemPrice = floatval("5.00");// column binding
$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 AddToCart
if (isset($_POST["eCart1_5_ATC"]) || isset($_POST["eCart1_5_ATC_x"])) {
$ATC_itemID = $_POST["eCart1_5_ID_Add"];
$ATC_AddIfIn = 0;
$ATC_RedirectAfter = "shopping_cart.php";
$ATC_RedirectIfIn = "";
$ATC_itemName = "Good Housekeeping 12 issues, 1 year";// column binding
$ATC_itemDescription = "";// column binding
$ATC_itemWeight = floatval("0");// column binding
$ATC_itemQuantity = "".$_POST["eCart1_5_Quantity_Add"] ."";// column binding
$ATC_itemPrice = floatval("3.00");// column binding
$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 AddToCart
if (isset($_POST["eCart1_6_ATC"]) || isset($_POST["eCart1_6_ATC_x"])) {
$ATC_itemID = $_POST["eCart1_6_ID_Add"];
$ATC_AddIfIn = 0;
$ATC_RedirectAfter = "shopping_cart.php";
$ATC_RedirectIfIn = "";
$ATC_itemName = "Oprah 12 issues, 1 year";// column binding
$ATC_itemDescription = "";// column binding
$ATC_itemWeight = floatval("0");// column binding
$ATC_itemQuantity = "".$_POST["eCart1_6_Quantity_Add"] ."";// column binding
$ATC_itemPrice = floatval("8.00");// column binding
$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
if ($eCart1->redirStr != "") {
header("Location: ".$eCart1->redirStr);
}
?>

Sign in to reply to this post

Jason ByrnesWebAssist

It is next to impossible to nail down the cause of a problem without steps to reproduce it, where the error only occurs sometimes for some people and not all, the first thing that comes to mind is an issue on the server with session garbage collection. It cold be that the server is emptying the session temp files from the php temp directory prematurely.

For each session that is started, a temp file is created on the server, this file is used to track the contents of the session and is deleted when the session expires, or the user closes their browser, the server may be deleting these temp files before it is supposed to.

It could also be that the user is crossing domains. when they first arrive at the home page, they are coming to:
index.php

it is possible that the add to cart button is forwarding them to:
cart.php


these would be considered two separate domains by the session cookie, so the cart would appear top be empty. the item was added to the cart page for the domain:
cart.php

instead.

Sign in to reply to this post

wbrooks199805

okay..I can give you this..

It is this:

It could also be that the user is crossing domains. when they first arrive at the home page, they are coming to:
index.php

it is possible that the add to cart button is forwarding them to:
cart.php

I did have them going from http to https and thats when I got the error. Then I changed the cart and the checkout page with the instructions from webassist and now its happening between the cart and the checkout page. Is it possible that the code is not in the right order on shopping cart page? I am attaching the 2 files.

Attached Files
Archive.zip
Sign in to reply to this post

wbrooks199805

I still need support..

Please read my message above..Maybe I didn't make myself clear that I still have the problem..Just making sure..:)

Sign in to reply to this post

Jason ByrnesWebAssist

Crossing from http to https will not cause the problem i described, as long as the domain stays the same.

So for example, going from:
www.mydomain.com


to:
www.mydomain.com

will not cause an issue. http vs. https only changes the port that is used to connect to the web site:
http = port 80
https = port 443

it does not change the domain.


When I test your pages I am not able to reproduce the problem. I will need to be able to reproduce the problem to be able to get an idea of the cause. With out being able to reproduce, I really have no way of knowing what the problem may be.

Sign in to reply to this post

wbrooks199805

Possibly?

This is what happens: The items are in the shopping cart. When the checkout button is clicked, its suppose to got to the checkout page. It stays on the shopping cart page and says the shopping cart is empty. It sounds to me that its something to do with the redirect "if shopping cart is empty" code. Can you see if the code is in the right places on the pages please?

Sign in to reply to this post

wbrooks199805

fixed

This has happened on a couple of my shopping carts on servers with Godaddy, there are 2 different servers for http and https so I implemented this: ecart_ssl_ht.pdf

Now we don't have the problems.

Sign in to reply to this post

Jason ByrnesWebAssist

Great, glad to hear you have got it working.

Sign in to reply to this post

wbrooks199805

Crap..spoke too soon..

Still getting ecart empty cart from http to https intermittently. WHY???

Sign in to reply to this post

Jason ByrnesWebAssist

do you have a set of steps to reproduce the problem?

If you can give me a set of steps that will reproduce the problem, I can likely figure out what is going wrong.

being able to reproduce the problem is the key to troubleshooting it. Without being able to reproduce the problem, I do not have enough information to determine why it is occurring.

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