View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

I need help with webpage redirects

Thread began 5/04/2009 5:21 pm by dan361579 | Last modified 5/05/2009 12:27 pm by dan361579 | 998 views | 2 replies

johnlanglois

What do you want to have happen.

Originally Said By: dan361579
  I'm new to eCart and not that hot at PHP either, I admit it. I'm an engineer in recovery. I keep swearing I'll never do this again....yet here I am, only one more tech layer out of date wishing BASIC still was and Fortran...whatever happened to Fortran? *sigh* Okay, here's my problem:

I'm having a heck of a time with redirecting to another page. Using DataAssist, making all the pages allowed in the dialog box, the redirects work fine between those pages.

Adding an Add To Cart button to the detail page will not redirect the page to bring up the cart. I open the server behaviors to look at the redirect text box and it contains "/cart.php". Seems like it should work. Trying "../cart.php" and "cart.php" doesn't work either. I can add a View Cart button to the Detail page and it works fine. The item went to the cart when Add To Cart was clicked, but the redirect is broken.

When I get to the cart and click Continue Shopping, the redirect back to the sending page won't work. When I click Clear Contents. It works, but then I'm stuck in the cart with no way to get back instead of being redirected to another page (such as the sending page).

On the cart page: Update works fine. Clear clears, but does not redirect, Checkout does nothing (I've run the checkout wizard), Continue Shopping does nothing.

Can someone please give me some ideas so I can break out of this loop?

God Bless you.  



If you miss BASIC wait until you wander into the OOP swamp. PHP can flow like basic, so it's not that far removed. Pay attention to WHERE your code gets inserted because it can impact the success you might have. Dreamweaver is bad about putting stuff in places that get the logic out of sequence.

In the case that you mentioned of the Add to Cart button, my question was "what does he want to have happen?" Normally, add to cart would serve as a trigger to post the form to the cart. Are you saying you want that button to send the user some place else first?

If you really wanted to have an item posted to the cart, look at the code to see if the add to cart button is correctly referenced.

For example, the code for the add to cart button on a form of mine reads
<input type="image" src="WA_eCart/Images/Deep Jungle/Btn1_EN_addtocart.gif" border="0" value="Add to Cart" name="eCart1_1_ATC">

It is in a form in the body of the page.

The code that executes when the button gets clicked resides at the top of the page and reads:

<?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 = "https://www.THECLIENTswebsite/public_shoppingcart.php";
..omitted for brevity

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'];
}
}
}
?>

Basically, the way the logic flows is that the whole page loads and does nothing.
Then when the user clicks the add to cart button, the page gets submitted to the server again and begins processing from the top down.

At that point, your button should test true and the subsequent steps would be executed.

You can insert die(mysql_error()); statements in the code to force the page to stop at any point.
You could echo backs vars that you have a question about or user var_dump or print_r prior to the die() command.
WebAssist also has some handy debug routines in some of their stuff.

Ask about them when you submit a ticket.

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