473,851 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Back button complicates ASP shopping cart item removal

Hi all,

I've built an online shopping cart using ASP Classic(based on a 'WebThang'
tutorial). The shop cart page (with table showing customers selected items
and costs) has only 3 buttons/links.

1: Back to Shop: Uses 'javascript:his tory.go(-1)' to go to previous page.

2: Remove Item(one next to each item in cart): Clears the selected item from
the session variable array redisplays the page.

3: Checkout: Proceeds nicely to the pages that collect the customers
details.

My Problem:

If the user clicks the 'Remove Item' link/button, the page efficiently
redisplays with the selected item removed from the list. However, if the
user then clicks either the 'Back to Shop' button or the browser Back button
(intending to continue shopping), the cart page redisplays showing the
removed item back in the list as it was before they removed it. Although the
session variable array remains correctly unaltered it is very confusing to
the user and will probably cause them to feel that their shopping list has
been 'messed up' and is now invalid.

I understand that the browser is just 'doing what it is told' but need to
find a way to avoid this confusing behaviour.

Any ideas,

Regards

Penny.
Jul 22 '05 #1
9 2340

"Penny" <pe***@spampoli ce.com> wrote in message
news:42******@f unnel.arach.net .au...
Hi all,

I've built an online shopping cart using ASP Classic(based on a 'WebThang'
tutorial). The shop cart page (with table showing customers selected items
and costs) has only 3 buttons/links.

1: Back to Shop: Uses 'javascript:his tory.go(-1)' to go to previous page.

2: Remove Item(one next to each item in cart): Clears the selected item
from
the session variable array redisplays the page.

3: Checkout: Proceeds nicely to the pages that collect the customers
details.

My Problem:

If the user clicks the 'Remove Item' link/button, the page efficiently
redisplays with the selected item removed from the list. However, if the
user then clicks either the 'Back to Shop' button or the browser Back
button
(intending to continue shopping), the cart page redisplays showing the
removed item back in the list as it was before they removed it. Although
the
session variable array remains correctly unaltered it is very confusing to
the user and will probably cause them to feel that their shopping list has
been 'messed up' and is now invalid.

I understand that the browser is just 'doing what it is told' but need to
find a way to avoid this confusing behaviour.
If you use location.replac e to navigate between pages, the old page gets
replaced in the history stack with the new page, giving you somewhat of an
opportunity to manage what's available to go back to.

-Mark
Any ideas,

Regards

Penny.

Jul 22 '05 #2
Hi Mark,

Do you have any snippets of code I could see to get a perspective on how
location.replac e can be used?

Regards

Penny.
"Mark J. McGinty" <mm******@spamf romyou.com> wrote in message
news:ui******** ******@tk2msftn gp13.phx.gbl...

If you use location.replac e to navigate between pages, the old page gets
replaced in the history stack with the new page, giving you somewhat of an
opportunity to manage what's available to go back to.

-Mark

Jul 22 '05 #3
If you don't want the user be able to see previous pages (exactly as they
were previously) you could likely prevent caching :
http://support.microsoft.com/kb/234067/en-us

Let us know if it works...

Patrice

--

"Penny" <pe***@spampoli ce.com> a écrit dans le message de
news:42******@f unnel.arach.net .au...
Hi all,

I've built an online shopping cart using ASP Classic(based on a 'WebThang'
tutorial). The shop cart page (with table showing customers selected items
and costs) has only 3 buttons/links.

1: Back to Shop: Uses 'javascript:his tory.go(-1)' to go to previous page.

2: Remove Item(one next to each item in cart): Clears the selected item from the session variable array redisplays the page.

3: Checkout: Proceeds nicely to the pages that collect the customers
details.

My Problem:

If the user clicks the 'Remove Item' link/button, the page efficiently
redisplays with the selected item removed from the list. However, if the
user then clicks either the 'Back to Shop' button or the browser Back button (intending to continue shopping), the cart page redisplays showing the
removed item back in the list as it was before they removed it. Although the session variable array remains correctly unaltered it is very confusing to
the user and will probably cause them to feel that their shopping list has
been 'messed up' and is now invalid.

I understand that the browser is just 'doing what it is told' but need to
find a way to avoid this confusing behaviour.

Any ideas,

Regards

Penny.

Jul 22 '05 #4
On Wed, 25 May 2005 19:49:08 +0800, "Penny" <pe***@spampoli ce.com>
wrote:
Do you have any snippets of code I could see to get a perspective on how
location.repla ce can be used?
It's a client-side Javascript so you may want to ask in a Javascript
group, but here's a reference page:

http://www.klaban.torun.pl/help/jsref/location.htm

Jeff


"Mark J. McGinty" <mm******@spamf romyou.com> wrote in message
news:ui******* *******@tk2msft ngp13.phx.gbl.. .

If you use location.replac e to navigate between pages, the old page gets
replaced in the history stack with the new page, giving you somewhat of an
opportunity to manage what's available to go back to.

-Mark


Jul 22 '05 #5
On Wed, 25 May 2005 11:46:49 +0800, "Penny" <pe***@spampoli ce.com>
wrote:
Hi all,

I've built an online shopping cart using ASP Classic(based on a 'WebThang'
tutorial). The shop cart page (with table showing customers selected items
and costs) has only 3 buttons/links.

1: Back to Shop: Uses 'javascript:his tory.go(-1)' to go to previous page.

2: Remove Item(one next to each item in cart): Clears the selected item from
the session variable array redisplays the page.

3: Checkout: Proceeds nicely to the pages that collect the customers
details.

My Problem:

If the user clicks the 'Remove Item' link/button, the page efficiently
redisplays with the selected item removed from the list. However, if the
user then clicks either the 'Back to Shop' button or the browser Back button
(intending to continue shopping), the cart page redisplays showing the
removed item back in the list as it was before they removed it. Although the
session variable array remains correctly unaltered it is very confusing to
the user and will probably cause them to feel that their shopping list has
been 'messed up' and is now invalid.

I understand that the browser is just 'doing what it is told' but need to
find a way to avoid this confusing behaviour.


I would think if you coded the shopping cart page to read the session
variables to populate the fileds and prevented caching on the page you
would see the result you want. Perhaps using a pragma:nocache header
would do it, you can use a meta tag for this:

<meta http-equiv="pragma" content="nocach e">

There are other ways to disable page caching as well.

Jeff
Jul 22 '05 #6
Patrice,

It works in that it prevents previously removed items from the cart being
shown again but when expecting to be redirected back to the last 'shopping'
page it usually says 'Warning: Page has Expired'.

The suggested code:

<% Response.CacheC ontrol = "no-cache" %>
<% Response.AddHea der "Pragma", "no-cache" %>
<% Response.Expire s = -1 %>

Seems to prevent redirecting to whatever the previous page was. My catch is
that I want to return to the 'shop' page that directed to the 'cart' page in
the first place but not return to an old version of the 'cart' page itself.
Jul 22 '05 #7

Thanks Jeff,

I'll have a play with that and get back to you.
Jul 22 '05 #8
Jeff,

<meta http-equiv="pragma" content="nocach e"> doesn't work either. It still
allows the page to redirect to the previous version of itself.

Penny.

I would think if you coded the shopping cart page to read the session
variables to populate the fileds and prevented caching on the page you
would see the result you want. Perhaps using a pragma:nocache header
would do it, you can use a meta tag for this:

<meta http-equiv="pragma" content="nocach e">

There are other ways to disable page caching as well.

Jeff

Jul 22 '05 #9
Gazing into my crystal ball I observed "Penny" <pe***@spampoli ce.com>
writing in news:42******@f unnel.arach.net .au:

I would think if you coded the shopping cart page to read the session
variables to populate the fileds and prevented caching on the page you
would see the result you want. Perhaps using a pragma:nocache header
would do it, you can use a meta tag for this:

<meta http-equiv="pragma" content="nocach e">

There are other ways to disable page caching as well.

Jeff,

<meta http-equiv="pragma" content="nocach e"> doesn't work either. It still
allows the page to redirect to the previous version of itself.

Penny.

IIRC the Meta element is controled by the browser and the browser can
disregard it. AFAIK you have to do it server side, eg:
Response.Expire s = 60
Response.Expire sabsolute = Now() - 1
Response.AddHea der "pragma","n o-cache"
Response.AddHea der "cache-control","priva te"
Response.CacheC ontrol = "no-cache"

--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Jul 22 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1512
by: Amit Kela | last post by:
Hi, I am using ASP on my webpage to pull up data from SQL tables. I am using a Shopping cart page where the users can place orders. The problem I have once the user has logged in and placed an order the shopping cart table is empty (as it should be). But when the user tries to place another order in the same session by adding an item to the cart, the table shows the new item along with the old item that has already been ordered (instead...
1
3589
by: madison | last post by:
Hi, I am trying to start a website using paypals shopping cart function. If i have 10 items and they sell out, how do I make it so the item is then listed as sold out. The next person would not be able to come along and add it to their shopping cart. thanks joy
1
1976
by: Paul Goodley | last post by:
Typically, shopping carts add a single item at a time, so it's easy to prompt the user for information needed for the order, but what if the shopping cart needs to process thirty items at once? I am working on a shopping cart for a wholesale project and have run into trouble. Retailers log into the site, click a link to take them to the category, and get table with images and a checkbox. They click the checkbox of each item they want to...
1
6435
by: Johan Nedin | last post by:
Hello! I am having a problem with the @OutputCache page directive and Web browser Back Buttons. Problem: After setting <%@ OutputCache Location="None" %> on my pages I get the "Warning! Page has expired" error message, when pushing the Back Button in my Web browser.
4
2416
by: Winshent | last post by:
I am having problems with adding items to my shopping cart. The problem occures when adding items that already exists in the cart. When a user adds to cart, they are automatically redirected to the cart, where they can update quantities. If the item already exists in the cart, i want to update the quantity by adding 1 to the quantity of that item. The code all works fine when i step thru the code, however when running it without...
1
9614
by: Alex Allage | last post by:
Hello, I am having a little problem. I have create a very basic shopping cart site. In the process of displaying items in the shop, I am using image buttons so that you may click on them and display detailed information for that item, and another button which allows you to add the item to your shopping cart. However, for some reason the events do not fire correctly, or when they do it seems that it is the prior buttons properties which...
7
2643
by: isaac2004 | last post by:
hi i have a basic asp page that acts as an online bookstore. on my cart page i am having trouble generating 3 numbers; a subtotal, a shipping total, and a final price. here is my code i would like it to work properly so that a record count counts through all the books and genertates these numbers. watch out for line breaks <%@ Language=VBScript %> <% Option Explicit %> <!--#include file="DatabaseConnect.asp"-->
10
3791
by: Martien van Wanrooij | last post by:
In a simple webshop application I am trying to check that the "shopping cart" only should be "filled" when you choose an article in "meerinfo.php" and click on a link to "winkelwagen.php". It works fine in that sense that when I would enter in the browser "www.mysite.php/winkelwagen?id=5"it will be ignored. However when I go from meerinfo.php to winkelwagen.php , the article is added again and again to the shopping cart when I click on...
3
5101
by: dotnetcy | last post by:
Hello, I have the following 'Add to Cart' button on my ASP.NET C# website that receives some values I previously saved in 2 session variables and then passes those values to an external script (a shopping cart) once the following button is clicked: <input id="product_name" value='<%Response.Write(Session);%>' class="product-title" type="hidden"> <input id="product_price" value='<%Response.Write(Session);%>' class="product-price"...
0
9895
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9744
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11011
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10725
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10352
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5735
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5931
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4547
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4142
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.