Unlimited order

Completed modifications to the NOP Shopping Cart. Additions, modifications, and more.

Moderators: Koibito, Stefko, Randy, Rosey

Unlimited order

Postby michelcramer » Wed Jan 05, 2005 1:13 pm

Hi there,

1. I found out that there is a maximum of items one can order, the message 'your shopping cart is full' will appear:
- is it possible to let people order an unlimited numer of different items?

2. When opening a shop, products one ordered a day ago are still in the cart, so people first have to delete the products they ordered before, before they can start to order new items... Is there a solution to solve this?

THANX for all your help!
michelcramer
 
Posts: 5
Joined: Mon Dec 13, 2004 9:47 am

Re: Unlimited order

Postby Randy » Wed Jan 05, 2005 3:14 pm

michelcramer wrote:1. I found out that there is a maximum of items one can order, the message 'your shopping cart is full' will appear:
- is it possible to let people order an unlimited numer of different items?


There is a great debate over this. Danny Goodman's "JavaScript Bible" is very explisit: 20 cookies per domain, each cookie must not exceed 2000 bytes in length, and the total length for all cookies from that domain is 4000 bytes. That leaves us with about 15 items depending upon how many other cookies you are using (nopcart uses 2 plus one for each product in the cart.

Another group (lead by KFLDesign.com and Netscape) asserts that the total per cookie is 4 K and that there is no limit to the total length of cookies, however, there is a limit of 20 cookies per domain.

It turns out that both groups are correct. Internet Explorer imposes the limits refered to by Danny Goodman, and Netscape Navigator and FireFox do not.

Since 95% of my vistors use IE, I will stay with the 15 items.

2. When opening a shop, products one ordered a day ago are still in the cart, so people first have to delete the products they ordered before, before they can start to order new items... Is there a solution to solve this?


The cookies used by nopcart for cart contents are called temporary cookies, and do not persist beyond the session. However the session lasts until you close your browser.

The best method is to go to a "Thank you" page following the checkout proceedure.
Have the "Thank you" page delete the cookies, or empty the cart by setting the numberOrdered cookie to zero with an "onload" method:

<BODY onload="SetCookie ('NumberOrdered', 0, null, '/');">

Have fun with it,

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

Postby michelcramer » Thu Jan 06, 2005 9:56 am

Thanx Randy :lol:
michelcramer
 
Posts: 5
Joined: Mon Dec 13, 2004 9:47 am

Postby michelcramer » Thu Jan 13, 2005 6:01 pm

I still have a problem with the maximum people can order; is there some way to solve this? Is it, for example, possible to put the orders in a database so people can order as much as they want?

I made this shop for a wholesaler, so their customers sometimes order more than 200 different items at once... Please let me know if there is any option which we can use, I even will pay for it!

Thanx to all of you,

Michel :shock:
michelcramer
 
Posts: 5
Joined: Mon Dec 13, 2004 9:47 am

Re: Unlimited order

Postby BartB » Fri Feb 11, 2005 4:09 pm

Randy wrote:That leaves us with about 15 items depending upon how many other cookies you are using (nopcart uses 2 plus one for each product in the cart.


Thanks for the info. This renders this script totally useless for any serious application.

Any suggestions for real database-driven (or even flatfiled) scripts that can do the job?
BartB
 
Posts: 2
Joined: Fri Feb 11, 2005 4:01 pm

Postby halyfax » Tue Mar 29, 2005 3:23 pm

anyone else have a suggestion for having unlimited products in your cart
halyfax
 
Posts: 10
Joined: Fri Feb 25, 2005 5:18 pm

Postby Maven » Thu Feb 09, 2006 4:30 am

I thought I'd share this with everyone.

To allow more items, we have modified the cart to use a single cookie for the entire cart contents. This is done by creating a single string containing all cart items. We have 6 characters for item number, 6 for price, 2 for quantity, and 50 for item name. We then parse the string to grab the specific info needed.

This solution might not work for everyone, but it works great for us and allows up to 30 items in the cart on IE. It seems to run fairly fast as well. If you need the code, feel free to email me.

If you'd like to see our implementation of the cart, go to:
http://www.divineromance.net/shopping/shopping.php

Note that we only use the nopcart.js file. I've designed our own unique UI.
Maven
WebMaster
 
Posts: 8
Joined: Thu Feb 09, 2006 4:24 am
Location: Missouri, USA

Postby FredBear » Fri Feb 24, 2006 6:30 am

Hi Maven,

I'd really like a closer look at your setup if possible. I often have customers wanting more that 15 items per order and this is a showstopper for me.

I'm surprised that no-one has a way of writing the data to a simple data table or flat file, but then I don't how how to do it myself so can't fathom how difficult, inconvenient or whatever it may be......
FredBear
WebMaster
 
Posts: 28
Joined: Sun Feb 12, 2006 9:03 am
Location: Melbourne, Australia

Postby Maven » Fri Feb 24, 2006 2:17 pm

OzStick,

The limit on the size of the cookie file (2k) prevents there from being too many different items in your cart, even with my solution. The best way around that would be to not use a cookie, but a session id, and keep the cart contents on the server instead. Of course, that would be a complete rewrite of the cart.

I will send you a message with my code, and you can see if it will help you. At least you'll be able to get 30 different items or so in a cart :)

Regards,
Maven
Maven
WebMaster
 
Posts: 8
Joined: Thu Feb 09, 2006 4:24 am
Location: Missouri, USA

Postby Docsonic » Tue Mar 07, 2006 4:02 pm

I too have a problem with the 19 limit, 30 may be enough for me though. I got the cart.js script off your site but I cannot get it to work on mine. Are there any other changes I need to make to make this work? I looked through the code but I am a severe novice at js so it is painful going for me. :?
The error I get is :

Could not convert undefined or null to object

BackTrace:
var ilen = ai_count - as_str.length;
var istring = rpadspace(itemNumber, 6) + rpadspace(itemPrice, 6) + rpadspace(itemQty, 2) + rpadspace(itemName, 50);

Line 1 of script
AddToCart(this.form);
At unknown location
[statement source code not available]

I would appreciate any assistance on this :D

Thanks,

Tony
Docsonic
 
Posts: 10
Joined: Mon Mar 06, 2006 5:42 pm
Location: Nova Scotia, Canada

Postby Maven » Tue Mar 07, 2006 4:18 pm

You need to keep most of the code the same as your existing cart.js file. I've made other mods for my specific use which don't apply to you. Just a few functions need to be modified. I'll send you a message with the code. You can also send me your email address if you want me to email it to you.
Maven
WebMaster
 
Posts: 8
Joined: Thu Feb 09, 2006 4:24 am
Location: Missouri, USA

Postby Docsonic » Tue Mar 07, 2006 4:29 pm

Thanks, I got the message with the code and I will take a look at incorporating it this afternoon.

I will keep you informed of my progress :D
Docsonic
 
Posts: 10
Joined: Mon Mar 06, 2006 5:42 pm
Location: Nova Scotia, Canada

Postby Docsonic » Tue Mar 07, 2006 5:20 pm

Hmmm I cut and pasted the sections of your code over the functions in the existing code but to no avail, I still get the same error as before. Are the extra sections of code (i.e. not the replacement functions, just the new ones) supposed to go in a specific place in the code or is that irrelevant?

There must be something silly I am missing here :?:

Thanks for all your help,

Tony
Docsonic
 
Posts: 10
Joined: Mon Mar 06, 2006 5:42 pm
Location: Nova Scotia, Canada

Postby Maven » Tue Mar 07, 2006 5:41 pm

It appears you are having a problem with the place in your page where you call the 'AddToCart' function. You are likely passing a null (blank) value for one or more of the parameters.

Perhaps you don't use the item name, or the item number?
Maven
WebMaster
 
Posts: 8
Joined: Thu Feb 09, 2006 4:24 am
Location: Missouri, USA

Postby Docsonic » Tue Mar 07, 2006 6:23 pm

I downloaded my website 'nopcart.js' file in case there was a problem with my localhost one. When I use the unaltered file it works fine but as soon as I apply your mod, no go. Also I am using the fields "QUANTITY", "NAME", "PRICE" and "ID_NUM", none of which are null, the script and field names are as per the examples I downloaded from NOP Design prior to my original setup. - for example...

<form Name=Cart style="float: right"><td height="1" valign="bottom">
<div align="right" style="width: 659; height: 31">
<right>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="662" height="42">
<tr>
<td width="291" height="24" valign="middle" align="center">
<p align="left"><font color="#800000">Product #&nbsp;385-0001</font>
<font color="#000000">-&nbsp;12 inch Square Mirror Tile</font></p>
</td>
<center>
<td width="108" height="24" valign="middle">
<p align="center">Rate $2.00</td>
</center>
</center>
<td width="59" height="1" valign="middle">
<p align="right">Quantity:</p>
</td><center>
<center>
<td valign="middle" width="48"><input type=text size=4 maxlength=4 name="QUANTITY" onChange='this.value=CKquantity(this.value)' value="1">
<input type=hidden name="PRICE" value="2.00">
<input type=hidden name="NAME" value="12 inch Square Mirror Tile">
<input type=hidden name="ID_NUM" value="385-0001">

</td>
<td width="146" height="1" align="right" valign="middle"><input type=button value=' Add to quote ' onClick='AddToCart(this.form)'>
</td>
</tr>
</table>
</center>
</div>
</center>
</div>
</form>
<<<<<Apologies for the code, FrontPage y'know>>>>>

This same format is repeated throughout the site with different values. Is there any way to trace what values are set for name, quantity, id_num & price when the script is running?

Again, many thanks :D
Docsonic
 
Posts: 10
Joined: Mon Mar 06, 2006 5:42 pm
Location: Nova Scotia, Canada

Next

Return to Modifications

Who is online

Users browsing this forum: No registered users and 1 guest