Unlimited order

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

Moderators: Koibito, Stefko, Randy, Rosey

Postby Maven » Tue Mar 07, 2006 7:17 pm

Ok... turns out I completely forgot I had changed the call to 'AddToCart' to include the information I was sending instead of a reference to the form itself.

You could modify your call on your web page to call AddToCart() with the values you wish to add instead of the 'This.Form'

-or-
you could change my code to work like the old by changing the top to grab the values from the form as follows:

Code: Select all
function AddToCart(thisForm) {
   if ( thisForm.ID_NUM == null )
      itemNumber    = "";
   else
      itemNumber    = thisForm.ID_NUM.value;

   if ( thisForm.QUANTITY == null )
      itemQty  = "1";
   else
      itemQty  = thisForm.QUANTITY.value;

   if ( thisForm.PRICE == null )
      itemPrice     = "0.00";
   else
      itemPrice     = thisForm.PRICE.value;

   if ( thisForm.NAME == null )
      itemName      = "";
   else
      itemName      = thisForm.NAME.value;


(keep the rest of the function the same)

One other change:
RemoveFromCart --- I added a new parameter 'DoRefresh' since I didn't always want to have the page reload when an item is removed. You'll need to remove that parameter, and the corresponding 'if' statement.

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

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

Awesome, lookin' good :D

Just two minor things now...

I don't have the confirmation popup any more, that was useful, and the description on the 'managecart' page and in the email is odd.... The price, quantity and ID number are all fine but the description (variable NAME) contains all the data, including the ID number, quantity and price.

I did change the string lengths for the variables from 6,6,2,50 to 8,6,3,47 -
rpadspace(itemNumber,8 ) + rpadspace(itemPrice,6) + rpadspace(itemQty,3)+rpadspace(itemName,47)

and I made the trim line the same...
RTrim(item.slice(0,8 ))+"|"+RTrim(item.slice(14,17))+"|"+RTrim(item.slice(8,14))+"|"+RTrim(item.slice(17,64))

I changed any reference I could find regarding the above changes (e.g. qty change being *64)+14)... instead of *64)+12)... ) but I obviously missed something there.

It looks almost there though!

:D

Thanks,

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

Postby Maven » Tue Mar 07, 2006 8:56 pm

If you look at my web site, you'll see why I removed the confirmation. Whenever someone adds something to the cart, it just gets added to the list on the left, so the confirmation is there.

You can add the "alert" back in. Look in your old AddToCart code for:
if ( DisplayNotice )
alert(notice);

You'll also need to create the notice string. In the old code, it was:
notice = strQUANTITY + " " + strNAME + strAdded;

I assume you made this change:
// Change any references in the code which look
// like this: database = GetCookie(NewOrder);
// to this: database = GetItem(i);

in the ManageCart, ListCart, etc.

I should note that I also don't use individual shipping costs and additional information for items. Because of this, the line:

fields[3] = database.substring( Token2+1, Token3 ); // Product Name/Description

should be changed to:
fields[3] = database.substring( Token2+1, database.length ); // Product Name/Description

the references to the other fields may be deleted.

If you need these fields, you'll have to add them to your string in the appropriate places. I don't have the time right now to help with that unfortunately.

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

Postby Docsonic » Tue Mar 07, 2006 9:00 pm

Not a problem, I appreciate all the help you have given me!
I will take a look at this tomorrow and see if I can tweak it to where I need it.

Again, multiple thanks!

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

Postby Docsonic » Wed Mar 08, 2006 3:33 pm

Hi Mike,

I did it!

My cart now takes 30 items (anything over 31 came up blank in Opera, I assume because 64*31=1984 thereby almost hitting the 2000 byte rule). As 30 should be enough for me I didn't try pushing the point to make 40, should I need to in the future then I will look at reducing description lengths to reduce the 64 down to maybe 50 bytes.

Anyhow, I figured out the popup, the messed up description and (another issue) the blank emails.

Many, many thanks - I can't tell you how much I appreciate your help.

:D :D Tony :D :D

====I will add this note here so that it is in with the topic====

Should anyone else try to impliment this mod using the checkout.pl script, two things, first make sure that AppendItemNumToOutput = true and secondly, in checkout.pl add lines to accomodate the extra lines from the form... i.e. after
if( $NAME_13 ){print MAIL "$QUANTITY_13 \$$PRICE_13 $ID_13 - $NAME_13 \n";}

Add new lines where 13 is 14, 15, 16....30. This is in 2 places and also, if you are saving a spreadsheet, modify that area too.

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

Postby FredBear » Thu Mar 09, 2006 1:29 am

Hi Mike,

I am about to start working this mod into my script and read the statement:

I should note that I also don't use individual shipping costs and additional information for items. Because of this, the line:

fields[3] = database.substring( Token2+1, Token3 ); // Product Name/Description

should be changed to:
fields[3] = database.substring( Token2+1, database.length ); // Product Name/Description

the references to the other fields may be deleted.


I am using ProductSelector, AdditionalInfo fields as well as the shipping mod (so weight is passed as well). Does this mean none of this data will be collected by your mod?

If not then I am once again back to square one as I have no idea how that stuff works!
FredBear
WebMaster
 
Posts: 28
Joined: Sun Feb 12, 2006 9:03 am
Location: Melbourne, Australia

Postby Maven » Thu Mar 09, 2006 1:48 am

More fields may be added on to the string. Basically, I just take all the information and create a single string for the cookie. In my case, that means 6 digits for the product ID, 6 for the price, 2 for the quantity and 50 for the description. If for example, you have a 4 digit weight to add, you could add it after the description. You'd just need to adjust all the code.

If you don't know enough about javascript in order to adjust the code, you should find someone who does to help you out. I'm in the middle of a project right now, so I don't have much time to help other than quick posts here and there. Glad to do what I can though.

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

Postby FredBear » Thu Mar 09, 2006 5:37 am

Thanks Mike,

I will try to take a look at it - I am working on a couple of other things at the moment myself so I appreciate how difficult it is to focus on too much at once!

I suppose that data could be appended to form a single variable string, THEN added? In other words, if I was to make it so A = B + C then A could be added to the cart in the format required?

I'll have a lash at adding the weight in so as to still use that functionality.

Cheers,
Chris
FredBear
WebMaster
 
Posts: 28
Joined: Sun Feb 12, 2006 9:03 am
Location: Melbourne, Australia

also looking into expanding the cart

Postby tiyen » Wed Oct 25, 2006 6:27 pm

Hello,

If you could also share the code with me, I'd really appreciate it. I've been wrestiling with trying to increase the shopping cart size for years! 19's just not enough for our purpose...

Thanks for your help!

Cheers,
Ty
tiyen
 
Posts: 1
Joined: Wed Oct 25, 2006 6:25 pm

Re: Unlimited order

Postby minolka » Wed Sep 12, 2007 12:31 am

Wonderful, Great job, Please pass me the mod.

Thanks,

Lee
minolka
WebMaster
 
Posts: 25
Joined: Wed Jun 06, 2007 2:46 am

Previous

Return to Modifications

Who is online

Users browsing this forum: No registered users and 0 guests

cron