close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Redirect issues and items won't add to cart.

Thread began 8/10/2009 2:57 pm by wes383912 | Last modified 11/11/2011 9:18 am by juha.morsky57580 | 5205 views | 7 replies |

wes383912

Redirect issues and items won't add to cart.

OK. So, I appear to be having the dreaded "redirect" issues many others are having.

Extension installed fine and I went through Display Manager to create Cart, and ran Checkout Wizard to create the rest of the pages. I created a couple of "add to cart" buttons for a few of the products, and uploaded everything to my Linux Server running PHP 5.

The problem with the adding to cart and redirects is that they work RANDOMLY, but more often, not at all.

Click add to cart, taken to a page that states "Your Cart is empty." Sometimes then clicking "View Cart" will make the item appear in the cart, but not usually. (This is the weird part, how inconsistently it's behaving.) When clicking "add to cart", it usually just reloads the page and nothing is placed in the cart. Server behaviors panel shows that the button has the correct redirect to "cart.php", my shopping cart page.

When I finally can see the cart, if I do a test to "clear the cart", it will usually work the first time. Then click "continue shopping" and nothing happens... page reloads. Again, checking the server behaviors in Dreamweaver shows that the buttons appear to have the correct file redirects attached to them.

Can't "remove item", cart reloads with same content. If I try to update the quantity and click "update cart", came thing.. page reloads with same cart contents.

I've only seen the "checkout.php" page once. It worked the FIRST time I tested it, but I haven't seen it since. Clicking the "checkout" button just reloads the cart page.

This is frustrating. Because the client needed the store up IMMEDIATELY (always, right?) I had to recreate the store with PayPal buttons until I can get this corrected. In the intrim, I've placed the files on a testing server in case someone can provide me any help.

I've tried the "Session_commit" settings recommended in other posts, but that didn't work. I've tried using both cookies and session variables to see if there was a change... nothing. This is a static store, so when the first instance didn't work, I took the original site files, created a new "site" in dreamweaver, went through all the steps to re-create the store, just to get the same results. I've done this "recreate site and setup eCart again" 6 times and got the same redirect errors each time. (Yes, I'm applying the eCart to a clean static site each time, NOT adding it onto a site I've already added eCart to, as I know that causes issues of it's own.

Lastly, I am using Dreamweaver CS3, Build 3481. I've tried it on a Mac and on a PC, just to make sure there were no problems with the platform and extension.

I will also copy and paste the cart.php code below for perusal.

Can anyone help me????

Thanks guys. I see other people using and loving eCart, so I'm hoping it's something ridiculously obvious, but I just can't make this guy work!

Here's the PHP portion of my shopping cart page:

<------------------------code--------------------->
<?php
//WA eCart Include
require_once("WA_eCart/mindblower5_PHP.php");
?><?php
$mindblower5->GetContent();
?><?php
// WA eCart Update
if (isset($_POST["mindblower5_Update_100"]) || isset($_POST["mindblower5_Update_100_x"])) {
$mindblower5->UpdateCart();
$Redirect_redirStr="";
if ($Redirect_redirStr != "") {
$mindblower5->redirStr = $Redirect_redirStr;
}
$mindblower5->cartAction = "Update";
}
?>
<?php
//WA eCart Check Out Update
if (isset($_POST["mindblower5_Checkout_1"]) || isset($_POST["mindblower5_Checkout_1_x"])) {
$mindblower5->UpdateCart();
$mindblower5->cartAction = "CheckOutUpdate";
}
?><?php
// WA eCart Continue Shopping
if (isset($_POST["mindblower5_Continue_100"]) || isset($_POST["mindblower5_Continue_100_x"])) {
$Redirect_redirStr="shop-motorcycle-performance.php";
if (true && isset($_SESSION['WAEC_ContinueRedirect'])) {
$Redirect_redirStr=siteToPageRel($_SESSION['WAEC_ContinueRedirect']);
}
if ($Redirect_redirStr != "") {
$mindblower5->redirStr = $Redirect_redirStr;
}
$mindblower5->cartAction = "Continue";
}
?><?php
// WA eCart Clear Cart
if (isset($_POST["mindblower5_Clear_100"]) || isset($_POST["mindblower5_Clear_100_x"])) {
$mindblower5->ClearCart();
$Redirect_redirStr="";
if ($Redirect_redirStr != "") {
$mindblower5->redirStr = $Redirect_redirStr;
}
$mindblower5->cartAction = "ClearCart";
}
?><?php
//WA eCart Redirect Check Out
if (isset($_POST["mindblower5_Checkout_1"]) || isset($_POST["mindblower5_Checkout_1_x"])) {
$Redirect_redirStr="checkout.php";
if ($Redirect_redirStr != "") {
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "") {
if (strpos($Redirect_redirStr, "?") === false) {
$Redirect_redirStr .= "?".$_SERVER['QUERY_STRING'];
}
else {
$Redirect_redirStr .= "&".$_SERVER['QUERY_STRING'];
}
}

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

Sign in to reply to this post

Jason ByrnesWebAssist

some PHP server have a bug with setting session contents then using the header() function to redirect.

to work around this bug, find the following code on the cart page and on the pages wi the add to cart buttons:
header("Location: ".$mindblower5->redirStr);


and change it to:
session_commit();
header("Location: ".$mindblower5->redirStr);

Sign in to reply to this post

wes383912

Thanks, Jason...

As I mentioned in my original post, I've already tried the "session_commit" fix mentioned in other's posts. Like them, it did nothing for me. Cart still just reloads the page, add to cart just reloads the page.

____EDIT_____ added later_____

As a test, I retried the "session_commit" fix again, but to no avail. I have loaded the site on two different Linux servers with two different hosting companies both running PHP5. No go on either of them, with or without the "session_commit" fix.

Any other ideas? Really hoping to get this working, as I've got three other projects I need to use this on, hopefully on one of those two servers.

Sign in to reply to this post

Jason ByrnesWebAssist

I will need to work with you to find the cause of the problem. I have Created a support ticket for you, please update the ticket so we can investigate the cause of the issue:
supporthistory.php

Sign in to reply to this post

Jason ByrnesWebAssist

We were able to resolve this issue by adding the following code at line 1 of the cart pages:

php:
<?php if(!session_id()) session_start(); ?>
Sign in to reply to this post

juha.morsky57580

same problem

I have a same problem, checkout redirect just reload kart.php page back.
and here is the source.... place please help me!!!

Juha

<?php if(!session_id()) session_start(); ?>
<?php
//WA eCart Include
require_once("WA_eCart/eCart1_PHP.php");
?>
<?php
$eCart1->GetContent();
?>
<?php
// WA eCart Update
if (isset($_POST["eCart1_Update_100"]) || isset($_POST["eCart1_Update_100_x"])) {
$eCart1->UpdateCart();
$Redirect_redirStr="index.php";
if ($Redirect_redirStr != "") {
$eCart1->redirStr = $Redirect_redirStr;
}
$eCart1->cartAction = "Update";
}
?>
<?php
//WA eCart Check Out Update
if (isset($_POST["eCart1_Checkout_1"]) || isset($_POST["eCart1_Checkout_1_x"])) {
$eCart1->UpdateCart();
$eCart1->cartAction = "CheckOutUpdate";
}
?>
<?php
// WA eCart Continue Shopping
if (isset($_POST["eCart1_Continue_100"]) || isset($_POST["eCart1_Continue_100_x"])) {
$Redirect_redirStr="";
if (true && isset($_SESSION['WAEC_ContinueRedirect'])) {
$Redirect_redirStr=siteToPageRel($_SESSION['WAEC_ContinueRedirect']);
}
if ($Redirect_redirStr != "") {
$eCart1->redirStr = $Redirect_redirStr;
}
$eCart1->cartAction = "Continue";
}
?>
<?php
// WA eCart Clear Cart
if (isset($_POST["eCart1_Clear_100"]) || isset($_POST["eCart1_Clear_100_x"])) {
$eCart1->ClearCart();
$Redirect_redirStr="";
if ($Redirect_redirStr != "") {
$eCart1->redirStr = $Redirect_redirStr;
}
$eCart1->cartAction = "ClearCart";
}
?>
<?php
//WA eCart Redirect Check Out
if (isset($_POST["eCart1_Checkout_1"]) || isset($_POST["eCart1_Checkout_1_x"])) {
$Redirect_redirStr="";
if ($Redirect_redirStr != "") {
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "") {
if (strpos($Redirect_redirStr, "?") === false) {
$Redirect_redirStr .= "?".$_SERVER['QUERY_STRING'];
}
else {
$Redirect_redirStr .= "&".$_SERVER['QUERY_STRING'];
}
}

$eCart1->redirStr = $Redirect_redirStr;
}
$eCart1->cartAction = "Checkout";
}
?>
<?php
// WA eCart Redirect
if ($eCart1->redirStr != "") {
session_commit();
header("Location: ".$eCart1->redirStr);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="WA_eCart/CSS/eC_Clean_Pacifica_Verdana.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="eC_Clean_Pacifica_Verdana">
<?php
//WA eCart Show If Start
if (!$eCart1->IsEmpty()) {
?>
<form action="<?php echo ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>" method="post" >
<h2>Your Shopping Cart</h2>
<table class="eC_ShoppingCart" border="0" cellspacing="0" cellpadding="0">
<tr>
<th>Name</th>
<th class="eC_PriceItem" >Price</th>
<th class="eC_FormItem" >Quantity</th>
<th class="eC_FormItem" >Remove</th>
<th class="eC_PriceItem" >Total</th>
</tr>
<?php
while (!$eCart1->EOF()) {
?>
<tr>
<td><img src="" alt="" width="110" height="110" class="eC_ProductThumb" />
<p class="eC_ItemLabel"><?php echo $eCart1->DisplayInfo("Name"); ?></p>
<p class="eC_ItemDescription"><?php echo $eCart1->DisplayInfo("Description"); ?></p></td>
<td class="eC_PriceItem" ><?php echo WA_eCart_DisplayMoney($eCart1, $eCart1->DisplayInfo("Price")); ?></td>
<td class="eC_FormItem" ><input type="text" name="eCart1_Quantity_<?php echo $eCart1->DisplayIndex; ?>" size="3" value="<?php echo $eCart1->DisplayInfo("Quantity"); ?>" /></td>
<td class="eC_FormItem" ><input type="checkbox" value="<?php echo $eCart1->DisplayInfo("ID"); ?>" name="eCart1_Delete_<?php echo $eCart1->DisplayIndex; ?>" /></td>
<td class="eC_PriceItem" ><?php echo WA_eCart_DisplayMoney($eCart1, $eCart1->DisplayInfo("TotalPrice")); ?></td>
</tr>
<?php
$eCart1->MoveNext();
}
$eCart1->MoveFirst();
?>
</table>
<div class="eC_OrderSummary">
<table border="0" cellpadding="0" cellspacing="0" class="eC_CartSummary">
<?php
//WA eCart Merchandizing Show Start
//ecart="eCart1"
if ($eCart1->GetDiscounts() > 0 || $eCart1->GetCharges() > 0 || $eCart1->GetShipping() > 0 || $eCart1->GetTax() > 0) {
?>
<tr>
<td class="eC_Subtotal eC_SummaryLabel">Sub-total</td>
<td class="eC_Subtotal"><?php echo WA_eCart_DisplayMoney($eCart1, $eCart1->TotalColumn("TotalPrice")); ?></td>
</tr>
<?php
//WA eCart Merchandizing Show End
//ecart="eCart1"
}
?>
<?php
//WA eCart Merchandizing Show Start
//ecart="eCart1"
if ($eCart1->GetDiscounts() > 0) {
?>
<?php
//WA eCart Merchandizing Show End
//ecart="eCart1"
}
?>
<?php
//WA eCart Merchandizing Show Start
//ecart="eCart1"
if ($eCart1->GetCharges() > 0) {
?>
<?php
//WA eCart Merchandizing Show End
//ecart="eCart1"
}
?>
<?php
//WA eCart Merchandizing Show Start
//ecart="eCart1"
if ($eCart1->GetShipping() > 0) {
?>
<tr>
<td class="eC_SummaryLabel">Shipping</td>
<td><?php echo WA_eCart_DisplayMoney($eCart1, $eCart1->GetShipping()); ?></td>
</tr>
<?php
//WA eCart Merchandizing Show End
//ecart="eCart1"
}
?>
<?php
//WA eCart Merchandizing Show Start
//ecart="eCart1"
if ($eCart1->GetTax() > 0) {
?>
<tr>
<td class="eC_SummaryLabel">Tax</td>
<td><?php echo WA_eCart_DisplayMoney($eCart1, $eCart1->GetTax()); ?></td>
</tr>
<?php
//WA eCart Merchandizing Show End
//ecart="eCart1"
}
?>
<tr class="eC_SummaryFooter">
<td class="eC_SummaryLabel">Total:</td>
<td><?php echo WA_eCart_DisplayMoney($eCart1, $eCart1->GrandTotal()); ?></td>
</tr>
</table>
</div>
<table class="eC_ButtonWrapper" cellpadding="0" cellspacing="0">
<tr>
<td><input type="submit" name="eCart1_Continue_100" id="eCart1_Continue_100" value="Continue Shopping" />
<input type="submit" name="eCart1_Clear_100" id="eCart1_Clear_100" value="Clear Cart" />
<input type="submit" value="Update Cart" name="eCart1_Update_100">
<input type="submit" value="Checkout" name="eCart1_Checkout_1"></td>
</tr>
</table>
</form>
<?php
//WA eCart Show If Middle
}
else {
?><table><tr><td>The cart is empty</td></tr></table>




<?php
//WA eCart Show If End
}
?>
</div>
</body>
</html>

Sign in to reply to this post

Jason ByrnesWebAssist

the checkout behavior needs to be updated to pint to the checkout page.

in the server behaviors panel, double click the eCart Checkout button behaivor, set it to point to the cehckout page.

Sign in to reply to this post

juha.morsky57580

oopss..

Sorry I attached the wrong source... however the problems solved already!

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