close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Returning to Previous Page When Clearing Cart

Thread began 8/20/2009 4:19 pm by duncanc213061 | Last modified 9/11/2009 3:39 pm by Jason Byrnes | 4267 views | 11 replies |

duncanc213061

Returning to Previous Page When Clearing Cart

I am using eCart 4.5.0 and Active Server Pages.

I would like have a visitor redirected back to the page that got him/her to the cart.asp page after he/she clears the cart.

Thank you in advance.

Sign in to reply to this post

CraigRBeta Tester

What i did was add a form with the same settings as the cart display form, containing just the 'continue shopping' link.
This has the advantage of using existing WA code, so if you change the action of 'continue shopping', it is updated here too.
Place the form immediately below the 'cart is empty' message
You will need to change the parameters to suit your page, but below are some examples from my pages.

Take a look at your own cart display form so you can tailor them as required...

ASP example

<form action="<% If(Request.QueryString <> "")Then Response.Write(CStr(Request.ServerVariables("SCRIPT_NAME"))&"?"&Server.HTMLEncode(Request.QueryString)) Else Response.Write(CStr(Request.ServerVariables("SCRIPT_NAME"))) %>" method="post" >
<input type="image" name="basket_Continue_100" id="basket_Continue_100" src="WA_eCart/Images/Slate/Btn2_EN_continueshopping.gif" alt="Continue shopping" />
</form>

PHP example

<form action="<?php echo ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>" method="post" >
<input type="submit" value="Continue Shopping" name="gallerybasket_Continue_100" alt="Continue Shopping">
</form>

(check spacings in the code posted above, as when I paste it, spaces appear which are not in the code, (eg SCRIPT_NAME))

Sign in to reply to this post

duncanc213061

Returning to Previous page When Clearing Cart

I was looking for something that would automatically take the visitor back to the page that got him/her to the cart.asp page.

I do not want to add another Continue Shopping button.

It should do the redirect immediately and without any further human intervention. Probably somewhere around the "WA eCart Clear Cart" block of code (somewhere around line 18 of cart.asp. I have attached the code below.

<%
' WA eCart Clear Cart
if (cStr(Request.Form("birdie_Clear_100")) <> "" OR cStr(Request.Form("birdie_Clear_100.x")) <> "") then
set birdie = WA_eCart_ClearCart(birdie)
Redirect_redirStr=""'_redirStr
if (Redirect_redirStr <> "") then
birdie_redirStr = Redirect_redirStr
end if
birdie_cartAction = "ClearCart"
end if
%>

Sign in to reply to this post

Eric Mittman

To do this within the clear cart code you can just borrow from the continue shopping code. Just after this line of code in your clear cart:

Redirect_redirStr=""'_redirStr

Add in this to set the redirect string to the page the user was on when they added to the cart:

if (true AND cStr(Session("WAEC_ContinueRedirect")) <> "") then
Redirect_redirStr=Session("WAEC_ContinueRedirect")
end if

So in the end the combined code would look like this:

<%
' WA eCart Clear Cart
if (cStr(Request.Form("birdie_Clear_100")) <> "" OR cStr(Request.Form("birdie_Clear_100.x")) <> "") then
set birdie = WA_eCart_ClearCart(birdie)
Redirect_redirStr=""'_redirStr
if (true AND cStr(Session("WAEC_ContinueRedirect")) <> "") then
Redirect_redirStr=Session("WAEC_ContinueRedirect")
end if
if (Redirect_redirStr <> "") then
birdie_redirStr = Redirect_redirStr
end if
birdie_cartAction = "ClearCart"
end if
%>

This session variable is set when you add to cart to record the current page, this is for the continue shopping but I think it will do what you are wanting in this case as well. Let me know if this is not what you were looking for.

Sign in to reply to this post

duncanc213061

Returning to Previous Page When Clearing Cart

This was exactly what I was looking for.

Thanks.

Sign in to reply to this post

michaelh387542

Doing this same effect in the URL window

This is great stuff!
My problem is that I am using a third party site that allows me to enter URLs and do links to other sites. I do not have access to html coding, but have to fill in their workbox for anchoring URLs.
I have modified some URLs with coding like: &fmt=18 and &autoply=1
But I have not been able to find coding language to put into the URL window that will return the viewer to my original site when the video is finished playing.
My site is: tishri.eventbrite.com
If you click on any picture in the Event Description section, you will see what I am talking about. I just want it to return automatically to the above site when the video is finished.
I would welcome any help in this regard and am totally open to suggestions.
- Michael

Sign in to reply to this post

duncanc213061

Returning to Previous Page When Clearing Page

Eric:

All of a sudden the Clear cart redirect is not working?

Don't know what happened. Didn't touch the code after inserting.

Code is below:

<%
' WA eCart Clear Cart
if (cStr(Request.Form("birdie_Clear_100")) <> "" OR cStr(Request.Form("birdie_Clear_100.x")) <> "") then
set birdie = WA_eCart_ClearCart(birdie)
Redirect_redirStr=""'_redirStr
if (true AND cStr(Session("WAEC_ContinueRedirect")) <> "") then
Redirect_redirStr=Session("WAEC_ContinueRedirect")
end if
if (Redirect_redirStr <> "") then
birdie_redirStr = Redirect_redirStr
end if
birdie_cartAction = "ClearCart"
end if
%>

Sign in to reply to this post

Eric Mittman

This code relies on the session variable that is set when an item is added to the cart. If it is not working then it is likely because this value has been reset or not set originally.

To check on this you can try printing out the value on the cart display page to ensure that it is set like this:

The value of the continue redirect session variable is: <%= Session("WAEC_ContinueRedirect") %>




@michaelh387542
I can see what you are talking about but I don't have any good advice on this. I think you may get a better response by posting to a youtube forum of some type, or maybe even posting here on a new thread.

Sign in to reply to this post

duncanc213061

Returning to Previous Page When Clearing Cart

I am not sure wat you mean when you say print out the value on the cart display.

And wher would this value be on the cart page. It sometimes works, and sometimes doesn't

Should there be something on each product page that will lead back to that page. I am somewhat befuddled by this.

Thank you in advance

Sign in to reply to this post

Eric Mittman

I will try to clear this up for you.

On your pages with the add to cart server behaviors this session variable is set to the current page:

Session("WAEC_ContinueRedirect")

The code in the clear cart relies on this session variable value to redirect you back to the correct page. Checking the value of this session variable is the first step to debug why it is not returning you to the correct page. To print this value out you need to put in the following code on your cart display page since this is where we make use of this session variable.

The value of the continue redirect session variable is: <%= Session("WAEC_ContinueRedirect") %>



You should select a part of the page where you would like to see this value then go into code view and paste it into place. The next time you get to the cart page it should display this message and the value of the session variable. Please perform some testing on this by adding items to the cart and clearing the cart and let us know the results you are getting.

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