Cleaning The Cart!

Problems installing or using the NOP Design Free Shopping Cart that do not fit into one of the above categories.

Moderators: Koibito, Stefko, Randy

Postby gcrary » Wed Mar 30, 2005 12:06 am

Not sure if this will help, but here is what I am using how...


<FORM ACTION="checkout.php" METHOD="POST" onSubmit="if( CheckForm(this)){ SetCookie ('NumberOrdered', 0, null, '/'); return true;} else { return false; }">
gcrary
 
Posts: 17
Joined: Wed Jun 23, 2004 4:04 pm
Location: Washington State

Postby remclave » Wed Mar 30, 2005 12:19 am

I'm using the checkout.pl and I don't know how to adapt the tag to it.
Image
remclave
 
Posts: 25
Joined: Sun Mar 13, 2005 5:08 pm
Location: NW Louisiana

Postby Randy » Wed Mar 30, 2005 4:11 am

The process flow is from the product pages to:
managecart.html
checkout.html
checkout.pl or php
thanks.html

The checkout. pl or php has a returnpage variable:

$returnpage - URL to send user when checkout is complete

set this to thanks.html or whatever the path to your return page is
Here is the top of my thanks.html page:
Code: Select all
<HTML>
<HEAD>
  <TITLE>THANK YOU - </TITLE>
<SCRIPT type="text/javascript" language="JavaScript">
<!--
    function delCookie (name) {
    var expireNow = new Date();
    document.cookie = name + "=" +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";
    }

// -->
</SCRIPT>
<LINK rel="stylesheet" href="store.css" type="text/css">
   <STYLE type="text/css">
 body {
  background-color: #FFFFFF;
      background-image: url(./images/home_bg.gif)
   color: #000099;
    }
</STYLE>
</HEAD>
<BODY onload="delCookie('NumberOrdered');" >



As soon as the checkout proceedure is complete, and that is the key word here, it returns the user to thanks.html. The onLoad method calls up the delete cookie function, so that the cart is empty once again.

It is easy, painless, and it works.

Randy
Randy
Guru
 
Posts: 1511
Joined: Tue Apr 22, 2003 12:21 pm
Location: Thunder Bay, Ontario

Postby goffenhiemer » Mon May 02, 2005 5:22 pm

I figered out what I was doing wrong. I already had an "onload" in my body tag and I wasn't adding the second "onload" correctly.

It is working now.
goffenhiemer
 
Posts: 21
Joined: Wed Jun 09, 2004 1:43 pm

Postby TBG » Fri Jul 22, 2005 5:22 pm

My process flow is only

managecart.htm
checkout.htm
thanks.htm


I have added the new code to nopcart.js

and added

<SCRIPT SRC="nopcart.js"></SCRIPT>

to the head section

And this code to the BODY section:

Code:
<SCRIPT>
cleanCart();
</SCRIPT>

It just dosent seem to work for me :shock:

Is it because that I dont not use The checkout. pl or php?

I even tried adding this to my thank you page after the first attempt didnt work out.

<HTML>
<HEAD>
<TITLE>THANK YOU - </TITLE>
<SCRIPT type="text/javascript" language="JavaScript">
<!--
function delCookie (name) {
var expireNow = new Date();
document.cookie = name + "=" +
"; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/";
}

// -->
</SCRIPT>
</HEAD>
<BODY onload="delCookie('NumberOrdered');" >
</body>

Regards
TBG
 
Posts: 1
Joined: Fri Jul 22, 2005 3:08 pm

Postby rewols » Sun Aug 28, 2005 5:33 am

i'm using checkout.pl. what works for me:

- add in the additional code in nocart.js
- set the return url in checkout.pl to xxx.html
- place the <SCRIPT>cleanCart();</SCRIPT> function within <body> of xxx.html
- set a redirect for xxx.html to your site

and yay, cart emptied.
rewols
 
Posts: 3
Joined: Sun Aug 28, 2005 5:28 am

Re: Cleaning The Cart!

Postby hardrock » Tue Oct 17, 2006 3:43 am

anis79 wrote:
axiom82 wrote:I have had a few people asking, "How can I remove the products ordered after checkout is complete?". Include this new function into your nopcart.js :)


This is the correct function you have to add (axiom82 forgot the quotes, thats why the error occured)

Code: Select all
function cleanCart(){
   var iNumberOrdered = GetCookie("NumberOrdered");
   if ( iNumberOrdered == null ){
         iNumberOrdered = 0;
   }
   for ( i = 1; i <= iNumberOrdered; i++ ) {
         NewOrder = "Order." + i;
         DeleteCookie(NewOrder, "/");
   }
   DeleteCookie("NumberOrdered", "/");
}


Hi,

I have copied above and pasted onto nopcart.js.
And also <SCRIPT SRC="nopcart.js"></SCRIPT> in head and <SCRIPT> cleanCart(); </SCRIPT> in body on cgi-bin
But it does not empty the cart.

Please give me any suggetion what I am wrong.

Thanks
hardrock
 
Posts: 1
Joined: Tue Oct 17, 2006 3:11 am

Postby Randy » Tue Oct 17, 2006 12:16 pm

You also need to load the language-en.js file too.

I use <body onload='cleanCart();'> to do the work, but any call to the function will empty the cart.

To test it add this line to the cleanCart function:

alert('cleanCart line xxx');

If you get the alert box, you know you are calling the function!

Randy
JRS SERVICES
e-commerence solutions
www.jrsservices.net
Randy
Guru
 
Posts: 1511
Joined: Tue Apr 22, 2003 12:21 pm
Location: Thunder Bay, Ontario

Another solution to clean the cart

Postby alberguer » Mon Oct 23, 2006 10:50 pm

I went to all the solutions given in this forum..yet, the cart was not empty after checkout...I tried another solution: I just add "onclick="cleanCart();"" to the submit buttom on the checkout.html page, using the code given before and added to nopcart.js...it is just working fine :D
alberguer
WebMaster
 
Posts: 16
Joined: Mon Oct 23, 2006 10:44 pm

Re: Cleaning The Cart!

Postby newfrad » Thu Mar 29, 2012 10:34 am

Hello i am new in your sites so please enplane question in detail....

function cleanCart(){
var iNumberOrdered = GetCookie("NumberOrdered");
if ( iNumberOrdered == null ){
iNumberOrdered = 0;
}
for ( i = 1; i <= iNumberOrdered; i++ ) {
NewOrder = "Order." + i;
DeleteCookie(NewOrder, "/");
}
DeleteCookie("NumberOrdered", "/");
}
newfrad
WebMaster
 
Posts: 1
Joined: Thu Mar 29, 2012 10:16 am

Previous

Return to Help: Cart / General

Who is online

Users browsing this forum: No registered users and 1 guest

cron