Maxium quantity

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

Moderators: Koibito, Stefko, Randy

Maxium quantity

Postby Cent » Tue Nov 11, 2003 9:33 am

Where can I limit the maximum number of quantity that can be ordered to, for example 50?
Cent
 
Posts: 2
Joined: Tue Nov 04, 2003 1:30 pm

Postby axiom82 » Tue Nov 11, 2003 9:29 pm

In the AddToCart() function in nopcart.js where it says:

Code: Select all
if ( iNumberOrdered > 12 )
         alert( strSorry );


Change it to:
Code: Select all
if ( iNumberOrdered > 50 )
         alert( strSorry );
axiom82
Guru
 
Posts: 57
Joined: Thu Jan 09, 2003 8:40 am

Postby Cent » Thu Nov 13, 2003 10:04 am

Thanks! What if I want to limit the number to be inputted in a textbox to 50?
Cent
 
Posts: 2
Joined: Tue Nov 04, 2003 1:30 pm

Max Quantity

Postby Randy » Thu Nov 13, 2003 2:01 pm

in nopcart.js

//---------------------------------------------------------------------||
// FUNCTION: CKquantity ||
// PARAMETERS: Quantity to ||
// RETURNS: Quantity as a number, and possible alert ||
// PURPOSE: Make sure quantity is represented as a number ||
//---------------------------------------------------------------------||
function CKquantity(checkString) {
var strNewQuantity = "";

for ( i = 0; i < checkString.length; i++ ) {
ch = checkString.substring(i, i+1);
if ( (ch >= "0" && ch <= "9") || (ch == '.') )
strNewQuantity += ch;
}

if ( strNewQuantity.length < 1 )
strNewQuantity = "1";

if ( parseInt(strNewQuantity) >50 )
strNewQuantity = "50";


return(strNewQuantity);
}

Of course this will only work if all your items in the store are limited to 50 of each. If not, you will have to give this function another name, and then call it only when you want to limit the quantity to 50.

and I don't know that you couldn't change the quantity on the managecart page...it may not call CKquantity. You will have to play with it!

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

bug

Postby Renato » Sat Apr 24, 2004 4:27 pm

I tried this, but, exactly changing the amount of 12 for 50 or another value any, it of the error. What it occurs is that it seems that has a limit of 20 products in the memory. It sees the error that it accuses: -- database is null or it is not an object -- E verifying database that it created, when it passes of 19 erases the first item to include the last one. E exactly thus, placing the limit for 19, it does not obtain to pass of the page "managecart.html" for the page "checkout.html" therefore in this accepted it in maximum 12 itens. You can say as I to me concert this? I wait... Renato
Renato
 
Posts: 3
Joined: Tue Apr 20, 2004 9:28 pm

Postby Randy » Sat Apr 24, 2004 4:45 pm

What Axiom was refering to was the maximum number of items allowed in the cart.

Because of the restrictions of the number of cookies allowed on a single domain (20), the max size of the shopping cart is set at 12 but can be bumped to 15 or maybe even 18...test it out first...my computer crashes at 16.

You can limit the quantity of any product that can be purchased...(in the case of samples, specials or loss leaders etc.)

If that is what you need, I can post the code (once I clean it up a bit)

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

Ok... i can help...

Postby Renato » Sun Apr 25, 2004 7:39 am

Tanks...
look that:

//-----------
function SetCookie (name,value,expires,path,domain,secure) {
document.cookie = name + "=" + escape (value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
//------------
In this function, the program set "cookies". But can't more 20.
If i save other cookies? And modificate your name. And to the end, in checkout or manager I call 2 functions... checkout1(); checkout2(); and one to one get the variables and insert to form.

This is have a chance, or other similar solution, to work?
(sorry, my ugly inglish. I don't speak very well).

And if this form send variables for one database, MySQL? Is possible?
Tanks
Waiting
Rey
Renato
 
Posts: 3
Joined: Tue Apr 20, 2004 9:28 pm

Postby Randy » Sun Apr 25, 2004 1:36 pm

20 is the maximum you can have on any domain.

The name refered to in the funciton:

function SetCookie (name,value,expires,path,domain,secure)

is the name of the cookie to be stored on the customer's computer.

Nopcart uses 1 for numberOrdered, 1 for shipping, and up to 18 for the products ordered.

In practice I can only get 15 before the computer slows down and finally crashes.

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

Oh!!!

Postby Renato » Sun Apr 25, 2004 3:57 pm

Is it possible the Javascript save the variables in the arquive .txt
:?:
Or other databases? MySQL?
Rey
Renato
 
Posts: 3
Joined: Tue Apr 20, 2004 9:28 pm


Return to Help: Cart / General

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron