Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Need Help with Javascript Shipping Cost Calculator
Old 08-13-2010, 03:15 PM Need Help with Javascript Shipping Cost Calculator
4layouts's Avatar
Skilled Talker

Posts: 66
Name: Mike McKeown
Location: St. Louis, MO
Trades: 0
I have this page I am editing for someone. The page uses Javascript to update order amounts and totals.

I have been attempting to add a shipping calculator. Each item has a different shipping amount. For example stickers cost $1, shirts are $5, etc.

I commented the code with a short description and the date. All my work was done between 8/9 and today.

The problem with it now is the shipping cost and grand total do not display at the bottom, but the totals for each category (hats, shirts, stickers, etc) works fine. I was hoping someone could help me get it working. I am not sure what I am doing wrong, and I don't mess around coding Javascript as much as I do other languages.

If you need any more info from me just let me know.

Thanks in advance!
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
4layouts is offline
Reply With Quote
View Public Profile Visit 4layouts's homepage!
 
 
Register now for full access!
Old 08-13-2010, 03:25 PM Re: Need Help with Javascript Shipping Cost Calculator
4layouts's Avatar
Skilled Talker

Posts: 66
Name: Mike McKeown
Location: St. Louis, MO
Trades: 0
Here is the file. It is an html page that is in a zip file so that I could upload it to this site.
Attached Files
File Type: zip catalog.zip (8.0 KB, 6 views)
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
4layouts is offline
Reply With Quote
View Public Profile Visit 4layouts's homepage!
 
Old 08-16-2010, 07:16 AM Re: Need Help with Javascript Shipping Cost Calculator
phpdasan's Avatar
Experienced Talker

Posts: 37
Name: Karthick B
Trades: 0
When i execute your page, its throws java script error like

Quote:
Error: document.ps_cart.cart_subtotal is undefined
in the function updateTotals
You have called updateShipping inside which you have called updateOverall,

Neither of the functions working after that error..

cart_subtotal is not found in the document, that what the error tells.

Correct the error, it will work..

If you are working with javascript, use Firefox error console.
It will show if any error occurs.
It is in Tools > Error Console you can use short key -> Ctrl +Shift + j
__________________
There is no secret ingredient.

Last edited by phpdasan; 08-17-2010 at 04:40 AM.. Reason: spelling and sentence correction
phpdasan is offline
Reply With Quote
View Public Profile
 
Old 08-16-2010, 01:34 PM Re: Need Help with Javascript Shipping Cost Calculator
4layouts's Avatar
Skilled Talker

Posts: 66
Name: Mike McKeown
Location: St. Louis, MO
Trades: 0
Got it working now! Thanks for your help. Looking back it was a pretty obvious fix, I just needed a little push in the right direction.

Thanks again!
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
4layouts is offline
Reply With Quote
View Public Profile Visit 4layouts's homepage!
 
Old 08-17-2010, 10:55 AM Re: Need Help with Javascript Shipping Cost Calculator
4layouts's Avatar
Skilled Talker

Posts: 66
Name: Mike McKeown
Location: St. Louis, MO
Trades: 0
Ok now I am having a differnet problem with the script. I got the shipping totals to calculate correctly, but I am having trouble sending the shipping amount to Paypal.

I looked at Paypal's website on how to set this up. They had an option for a handling charge and I tried setting that code up with the shipping total variable thrown in. That didn't work.

The next thing I tried was adding the shipping cost as a product using the variable I created for the shipping cost. This isn't working either. I changed the code a few times but it seems like nothing is getting sent to Paypal.

I've attached the page to this post. The code for creating shipping cost for an item is:

Code:
document.ps_cart.item_name_22.value = "Shipping Cost";
document.ps_cart.item_number_22.value = "shipping";
document.ps_cart.amount_22.value = Number(document.ps_cart.paypalShipping.value);
document.ps_cart.quantity_22.value = Number(1);
and you can see near the bottom of the page code to send this to Paypal. I don't know what I am doing wrong, or if it is even possible to do it this way. Hopefully someone can help me.
Attached Files
File Type: zip catalog.zip (8.1 KB, 4 views)
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
4layouts is offline
Reply With Quote
View Public Profile Visit 4layouts's homepage!
 
Reply     « Reply to Need Help with Javascript Shipping Cost Calculator
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23177 seconds with 13 queries