calculating frieght

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

calculating frieght

Post by C_Calav »

hey guys,

i was wondering if someone could point me in the right direction of the best way to calculate frieght on a shopping cart.

what are the methods people use or anything anyones know abot this would be very helpfull.

thanx!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I believe the major shippers (UPS, FedEx, DHL, etc) all have API's for calculating their shipping charges.

I know you could technically use their websites to calculate it, however, you will require permission to do so (at the least)
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

thanx feyd, so is that what most people do? any other ways of calculating frieght you know? i guess just writing code for it would be one way?
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

I think i've seen a script on zend that can be used to do this, give me a few minutes to find it and i'll post a link.

edit: the zend site seems to be going quite slow so it may take a while for me to find it.
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

thanx nigma! that would be great!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

via googling: [google]~freight site:zend.com[/google]

UPS class: http://www.zend.com/codex.php?id=202&single=1
USPS Priority Mail: http://www.zend.com/codex.php?id=618&single=1
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

cheers feyd!
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

hmmm... zend is still going pretty slow for me. Did you actually visit there site to get that or did you just use the links on google?
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

i used the links cant access anything
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Check back tomorrow or later tonight.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I used the google cache :D :lol:

here's how I got the pages:

did the google search above.
clicked "cached" in their entry.
clicked "cached text" in the cache page.

er, clicked. :D
Last edited by feyd on Sat Oct 09, 2004 11:50 pm, edited 1 time in total.
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

wow, woopdefreakin' doo! :P
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

im getting a phase error unexpected t string

is this vaild code? is equals to etc...?

Code: Select all

<?php
	if ($C_Freight == North Island New Zealand)
			{
				$shipping = 10;
			}
			if ($C_Freight == South Island New Zealand)
			{
				$shipping = 20;
			}
			else
			{
				$shipping = 30;
			}  
?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

quote your strings! :P
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post by mudkicker »

and even to optimize use * switch() * for it ;)
Post Reply