Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #22393
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Javascript Help Needed |
| Date | 2013-12-25 02:16 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <l9df6r$do9$4@dont-email.me> (permalink) |
| References | <6h5uu.25363$gh2.7307@fx24.iad> <l9colr$do9$2@dont-email.me> <JLluu.70428$Rt7.49487@fx27.iad> |
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. > 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". -- Denis McMahon, denismfmcmahon@gmail.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