Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #22394
| From | Jim Rojas <jrojas@tech-man.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Javascript Help Needed |
| References | <6h5uu.25363$gh2.7307@fx24.iad> <l9colr$do9$2@dont-email.me> <JLluu.70428$Rt7.49487@fx27.iad> <l9df6r$do9$4@dont-email.me> |
| Message-ID | <7Iruu.42141$BO3.7458@fx06.iad> (permalink) |
| Organization | TeraNews.com |
| Date | 2013-12-24 21:48 -0500 |
Denis McMahon wrote: > On Tue, 24 Dec 2013 15:02:47 -0500, Jim Rojas wrote: > >> Rate 1 is FCPIS Rate 2 is PMI Rate 3 is PMEI > > You are assuming that I understand your abbreviations. I don't. They mean > nothing to me in the UK, nor I suspect to others outside of your postal / > shipping environment. Try explaining things better so we understand what > you're trying to do. If a customer from Brazil wants to know what the cost is to send a 1 pound package from my location to his country, he then: 1. Selects his country. 2. Enters the package weight in US pounds or Kg. 3. The instant he enters the weight, 3 different shipping costs show up. FCPIS is First Class Mail (2-4 weeks delivery) PMI is Priority Mail (6-10 days delivery) PMEI is Express Mail (3-5 days delivery) So for example it would display: FCPIS: $18.00 PMI: $24.50 PMEI: $38.95 The code works fine as is. But it is for only one rate array. I just need it to include 2 additional arrays. So right now, the code displays the same rate for each service, because the other arrays do not exist, and my code is duplicated for each service to display the only available array data. Thank you Jim Rojas >> The script is originally only setup to display only one rate. The other >> rate arrays do not exist yet. > >> All I did was copy the same output code display, and changed the name >> for display purposes only. > > Try looking at this page: > > http://www.sined.co.uk/tmp/usps2.htm > > Note that I have separated the data array variables, the javascript and > the html. I gave up with the original js and wrote my own from scratch, > although it could probably benefit from some performance optimisations > and being made a little more robust concerning the values it expects as > input and in the data arrays. > > You don't need to separate the national and international calculation, > you can detect from the selection of USA as country that you want a zip > code. If the country is not USA, perform an international calculation, > otherwise perform a zip based calculation. If USA is selected and no zip > is supplied, show an error indication on the zip field. > > Question - are the other rates based on the same zip code and > international shipping zones as the USPS rates? If not, you will need > separate zone data as well as separate zone -> rate lookups for them. > > Ditto the maximum weights. > > Your international data appears to assign the same country code to Vanuata > and Uzbekistan, but although the the country code to zone lookup places > both entries for UZ in the same zone, they have different maximum > weights. This will cause a problem as either the maximum weight for > Vanuatu will always be chosen, or the maximum weight for Uzbekistan. > > My code should be extendable to handle your multiple shipping methods > provided that you make relevant edits and provide suitable data arrays to > it, and that the general format of the other data arrays is the same as > that of the USPS arrays. > > Note that the only changes you should need to make, if you provide > suitably defined arrays of data for FCPIS, PMI and PMEI is to change the > array names in the relevant lines in the array variable called control at > the head of the usos2_code.js file, and to include the data files for the > other methods in the document head. > > At the moment the code just calculates all 4 values using the same data > arrays, as defined by the entries in the array variable "control". > --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Javascript Help Needed Jim Rojas <jrojas@tech-man.com> - 2013-12-23 20:17 -0500
Re: Javascript Help Needed "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-12-24 09:17 +0100
Re: Javascript Help Needed Jim Rojas <jrojas@tech-man.com> - 2013-12-24 10:01 -0500
Re: Javascript Help Needed Jim Rojas <jrojas@tech-man.com> - 2013-12-24 10:02 -0500
Re: Javascript Help Needed "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-12-24 18:11 +0100
Re: Javascript Help Needed Jim Rojas <jrojas@tech-man.com> - 2013-12-24 12:24 -0500
Re: Javascript Help Needed "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-12-24 19:03 +0100
Re: Javascript Help Needed Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-24 19:18 +0000
Re: Javascript Help Needed Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-12-25 23:06 +0000
Re: Javascript Help Needed Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-24 19:52 +0000
Re: Javascript Help Needed Jim Rojas <jrojas@tech-man.com> - 2013-12-24 15:02 -0500
Re: Javascript Help Needed Christoph Michael Becker <cmbecker69@arcor.de> - 2013-12-24 22:07 +0100
Re: Javascript Help Needed Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-25 02:16 +0000
Re: Javascript Help Needed Jim Rojas <jrojas@tech-man.com> - 2013-12-24 21:48 -0500
Re: Javascript Help Needed Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-12-25 23:05 +0000
Re: Javascript Help Needed Christoph Michael Becker <cmbecker69@arcor.de> - 2013-12-24 22:09 +0100
Re: Javascript Help Needed Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-25 01:51 +0000
Re: Javascript Help Needed Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-26 07:38 +0100
Re: Javascript Help Needed Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-26 10:42 +0100
Re: Javascript Help Needed Jim Rojas <jrojas@tech-man.com> - 2013-12-26 13:14 -0500
Re: Javascript Help Needed Christoph Michael Becker <cmbecker69@arcor.de> - 2013-12-27 22:49 +0100
Re: Javascript Help Needed Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-27 23:25 +0100
csiph-web