Clearing Cart After Order Completion

Problems installing or using the NOP Design Free Shopping Cart. **ARCHIVE** Please post new topics to one of the groups below.

Moderator: scott

Clearing Cart After Order Completion

Postby eagle1 » Tue Jan 28, 2003 1:30 am

Can anyone tell me if it is possible to clear the cart after the order is completed? If so, any suggestions would be appreciated.

Also is it possible to Discount based on order totals??
eagle1
 
Posts: 3
Joined: Tue Jan 28, 2003 1:15 am

Postby Steven Nyland » Tue Jan 28, 2003 2:43 am

Hi Eagle,

To clear the cart (after submitting the checkout form), please replace the current form tag on your checkout.html page:

Code: Select all
<form action="/cgi-bin/checkout.pl" method="POST" onSubmit="return CheckForm(this)">


With:
Code: Select all
<form action="/cgi-bin/checkout.pl" method="POST" onSubmit="return CheckForm(this);SetCookie ('NumberOrdered', 0, null, '/');document.location=('managecart.html')">


If you require an "empty cart" button for on your managecart.html page, then please see the 'empty cart function' post (same forum).

It is possible to give discounts based on totals. What did you have in mind?

Steven
[ If it ain't Dutch ... it ain't Much ]
Steven Nyland
Guru
 
Posts: 274
Joined: Thu Jan 02, 2003 1:20 pm
Location: Still here ...

Clearing Cart

Postby eagle1 » Tue Jan 28, 2003 4:20 am

Steven,

First.. Thanks for the reply

The "Clear Cart" Button works Fine.. But for some reason the clear cart after check out did not.. My code is a little different.. It looks like this:

<form action="/cgi-bin/checkout.pl" method="POST">
<script>
CheckoutCart();
</script>

I appreciate the help.. Thanks
eagle1
 
Posts: 3
Joined: Tue Jan 28, 2003 1:15 am

Discount

Postby eagle1 » Tue Jan 28, 2003 5:14 am

Steven,

When I asked about discounts, had something in mind like this..

If I have a company that does a lot of business with me.. Say Company XYZ or Company ABC.. Could I set up an input feild where a code could be entered that would trigger a set discount of the subtotal costs based on the value of the code?

Say Company ABC code was ABC1 and Company XYZ code was XYZ2.. Then the input of ABC1 would trigger a 5% discount.. Input of XYZ2 would trigger a discount of 10%..

Am I makeing any sense?? Or just asking to much of a free shopping cart??... A very good free shopping cart, I might add!!
eagle1
 
Posts: 3
Joined: Tue Jan 28, 2003 1:15 am

Postby Steven Nyland » Tue Jan 28, 2003 5:45 pm

The 'kill cart' function only works in the submit button, -so- we need to move the string from the <form> tag to the submit button tag:

Form tag should be:
Code: Select all
<form action="/cgi-bin/checkout.pl" method="POST" onSubmit="return CheckForm(this)">


Submit button should be:
Code: Select all
<input type=submit Value="  Send Order  " onClick="SetCookie ('NumberOrdered', 0, null, '/');">


I have tested it and it works fine.

For the discount (per client) function, I will post a client discount MOD in this forum shortly. I'll reply again to this post -so- you'll receive a notification when it's there.

Steven
[ If it ain't Dutch ... it ain't Much ]
Steven Nyland
Guru
 
Posts: 274
Joined: Thu Jan 02, 2003 1:20 pm
Location: Still here ...

Postby Steven Nyland » Wed Jan 29, 2003 11:41 pm

Hi,

Just found out that the onClick function in the submit button is quite doggy as it only works when the customer qualified the form validation. If the customer forgot to fill in a field then the cart items are still being deleted.

I will continue to look for a safe solution. I'll let you know by posting here again.

Steven
[ If it ain't Dutch ... it ain't Much ]
Steven Nyland
Guru
 
Posts: 274
Joined: Thu Jan 02, 2003 1:20 pm
Location: Still here ...

Postby scott » Thu Jan 30, 2003 7:19 pm

Why not just do:

Code: Select all
<form action="/cgi-bin/checkout.pl" method="POST" onSubmit="if( CheckForm(this)){ SetCookie ('NumberOrdered', 0, null, '/'); return true;} else { return false; }">


Of course a better solution would be to put in the perl code before the content-type a Set-Cookie header that sets NumberOrdered to 0.

-Scott
scott
Site Admin
 
Posts: 558
Joined: Sun Jul 14, 2002 7:00 pm
Location: Phoenix, AZ

Postby justin » Mon Mar 17, 2003 3:25 pm

Most obvious place to put it would be in a thankyou page, or put in the checkout.pl to be written to the thankyou page.
justin
 
Posts: 53
Joined: Fri Nov 29, 2002 4:35 pm
Location: UK


Return to Installation and Setup Problems

Who is online

Users browsing this forum: No registered users and 0 guests

cron