Jump to content
Sign in to follow this  
mtechama

Shipping Cost By Zip Codes

Recommended Posts

Yes I need to find out how to set my shipping cost by zip codes and their Zones. Here is an link of Zip Code and Zones:

 

http://www.mtechama.com/snapshot/shipping_chart.htm

 

and here is a map of the shipping zones:

 

maponly.jpg


Wade Morris

Amarillo, Texas

 

Before you do any changes on your site you need to do BACKUP! BACKUP!

Share this post


Link to post
Share on other sites

I think I can go on this list too. My distributor offers drop shipping, so I need to be able to ship from different locations around the United States. I think thats the same thing you guys are talking about right? ;)

 

You would do this by making it possible to have more than one Zone under My Store->Zone, right?

Edited by jakeklem

Share this post


Link to post
Share on other sites
I think I can go on this list too. My distributor offers drop shipping, so I need to be able to ship from different locations around the United States. I think thats the same thing you guys are talking about right? ;)

 

You would do this by making it possible to have more than one Zone under My Store->Zone, right?

The zones shipping really doesn't act right for this sort of thing. I've looked into it and triggers off a two digit Country Code that is loaded into a database table. Now becuase all of my delivery areas have the same first three digits, i suppose i *could* use the last two digits as a "virtual" country code and then try to massage that module to work like that, but it would be a kludge, so like I said I started working on a real solution to this problem.

 

I got some headway last night and created a "zipcode.php" shipping module that integrates into the admin. Now all I have to do is create a database table to hold the zipcode and the amount, load it, and then use that data in the module. I should have something by the end of the week.

Edited by menriquez

Share this post


Link to post
Share on other sites
Any progress?

Glad you asked...i was getting ready to post anyway. It's moving along but with Valentine's Day this last week has been super busy and I have not had the time to code. Also, to aid in development I have installed phpEd, an awesome real-time debugging environment, and while it is helping me understand the entire osCommerce php "shebang", getting up to speed with phpEd has slowed the actual *development* down for now.

 

Tomorrow is V-Day, and I look forward to being able to get back to work on this project.

Share this post


Link to post
Share on other sites
Glad you asked...i was getting ready to post anyway....

 

Keep up the good work! Sorry if im being impatient, but any idea when it will be finished?

Share this post


Link to post
Share on other sites
Keep up the good work! Sorry if im being impatient, but any idea when it will be finished?

Yeah I'll have something running after the weekend....it won't be super slick or anything and you will probably have to enter the zips and prices through an included .sql file for now, but it will work for sure.

Share this post


Link to post
Share on other sites

Allright I have a beta version of this running pretty nicely on my development box. It basically is a clone of the current "zones" shipping method which allows you to not only choose the zipcode(s) to ship/deliver to, but also allows you to add a handling fee or a weight fee for each "zone".

 

Now pretty all that is left is to learn the proper submission procedure to get this module uploaded here...probably give this a shot tonight...

Share this post


Link to post
Share on other sites
Allright I have a beta version of this running pretty nicely on my development box. It basically is a clone of the current "zones" shipping method which allows you to not only choose the zipcode(s) to ship/deliver to, but also allows you to add a handling fee or a weight fee for each "zone".

 

Now pretty all that is left is to learn the proper submission procedure to get this module uploaded here...probably give this a shot tonight...

 

 

Mark,

 

Was wondering if you were still going to post the code for the zip code delivery fee contrib. I've been trying for weeks to put together something similar but have been beating my head against the wall (maybe that's why I haven't been able to do it). If you've got it working and can post the code, I'd be ever grateful.

 

RC

Share this post


Link to post
Share on other sites
Mark,

 

Was wondering if you were still going to post the code for the zip code delivery fee contrib. I've been trying for weeks to put together something similar but have been beating my head against the wall (maybe that's why I haven't been able to do it). If you've got it working and can post the code, I'd be ever grateful.

 

RC

Yep Rich just uploaded the module a sec ago...its working very well at my live site (3 orders in different zips processed perfectly today), so I am confident that it is solid.

 

Please keep me posted if with any comments or questions...

 

- mark

Share this post


Link to post
Share on other sites

Hey Menriquez .. Great Work.

 

I have been mulling over a few ideas for this for a while ... but have not had the initiative to go very far. I was tring to think of a way to include both ... ZIP codes for U.S.A ... and Postal Codes for Canada.

 

The problem with Postal Codes is that they are separated by a hyphen - ... that has to be stripped out before posting. Instead of for example M4T-4B6 it would have to be M4T 4B6.

 

--------------------------------------------------------

 

On another note .. for a total separate purpose of just looking up ZIP or Post Code details for orders etc.

 

I have modified a contrib called Orders Tracking which has tracking by ZIP so that it does essentially the same thing for Post Codes by accessing http://www.postalcodedownload.com/ for Canadian zones

 

I can get it to bring up the right group ie M4T .. but can't get it to isolate from the table location list that exact one. ie M4T 4B6

 

Here is the file below if you are interested .. or could take a quick look. If not thats ok.

 

 

<?php

/*

$Id: orders_tracking_postcodes.php,v 2.4 August 20, 2004 01:30:00

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Orders Tracking originally developed by Kieth Waldorf

Other Orders Tracking functions added to package by Jared Call

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

?>

 

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<br>

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

<script language="javascript" src="includes/general.js"></script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

<br>

 

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" align="center" width="95%" cellspacing="0" cellpadding="2">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

 

<tr>

<td><table border="0" align="center" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<br>

<tr>

<td class="dataTableContent" align="left">

<center><?php

echo tep_draw_form('search', FILENAME_STATS_ORDERS_TRACKING_POSTCODES, '', 'get');

echo HEADING_SELECT_YEAR . ' ' . tep_draw_input_field('year', '', 'size="4"');

echo '     ' . HEADING_SELECT_MONTH . ' ' . tep_draw_input_field('month', '', 'size="4"');

echo '     ' . HEADING_SELECT_POSTPREFIX . ' ' . tep_draw_input_field('postcode_prefix', '', 'size="3"');

echo '   <input type="submit" value="'. HEADING_TITLE_RECALCULATE .'">';

echo '</form>';

?></td>

</tr>

</table></td>

</tr>

 

<tr>

<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

 

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr class="dataTableHeadingRow" bgcolor="silver"><th class="dataTableHeadingContent" align="left"> <?php echo HEADING_ZONE; ?><th class="dataTableHeadingContent"><?php echo HEADING_ORDER_COUNT; ?></tr>

 

<?php

 

// if no year has been selected, use current year

if (isset($HTTP_GET_VARS['year'])) {

$year=$HTTP_GET_VARS['year'];

}

else {

$year = date('Y'); #current year

}

 

// if selected a month but not year, assume current year

if ($HTTP_GET_VARS['year'] == '') {

$year = date('Y'); #current year

}

 

// if a month has been selected, set the date range for just that month

if (isset($HTTP_GET_VARS['month'])) {

$startmonth=$HTTP_GET_VARS['month'];

$endmonth=$startmonth;

}

 

// if no month has been selected, we want entire year of data

if ($HTTP_GET_VARS['month'] == '') {

$startmonth = 01;

$endmonth = 12;

}

 

if ((isset($HTTP_GET_VARS['postcode_prefix'])) && ($HTTP_GET_VARS['postcode_prefix'] != '')) {

$prefix = '"' . $HTTP_GET_VARS['postcode_prefix'] . '"';

//$end = '"' . $HTTP_GET_VARS['postcode_end'] . '"';

$postcode_query = tep_db_query("SELECT count(*) AS count, customers_postcode FROM " . TABLE_ORDERS . " WHERE substring(customers_postcode,1,3) = $prefix and customers_postcode IS NOT NULL and date_purchased >= '$year-$startmonth-01 00:00:00' and date_purchased <= '$year-$endmonth-31 11:59:59' GROUP BY customers_postcode ORDER BY customers_postcode DESC LIMIT 50");

 

while ($customers_location = tep_db_fetch_array($postcode_query)) {

$location_contents .= '<tr class="dataTableRow"><td class="dataTableContent"> ' . $customers_location['customers_postcode'] . '</font>';

 

if (is_numeric($customers_location['customers_postcode'])) {

$location_contents .= '  [ <a href=' . ZIP_URL . $customers_location['customers_postcode] . '" target="_blank">' . ZIP_CODE_LOOKUP . '</a> ]';

}

// NOT FINISHED // still need to get last 3 digits into the postal code lookup. Can only get first 3 to show up

elseif (($customers_location['customers_postcode'])) {

$location_contents .= '  [ <a href=' . POST_CODE_URL . $HTTP_GET_VARS['postcode_prefix] . '/' . $HTTP_GET_VARS['postcode_end'] . '" target="_blank">' . POST_CODE_LOOKUP . '</a> ]';

}

 

$location_contents .= '</td><td class="dataTableContent" align="center">' . $customers_location['count'] . '</td></tr>';

}

 

} else {

 

$location_query = tep_db_query("SELECT count(*) as count, substring(customers_postcode,1,3) as customers_postcode from " . TABLE_ORDERS . " WHERE customers_postcode IS NOT NULL and date_purchased >= '$year-$startmonth-01 00:00:00' and date_purchased <= '$year-$endmonth-31 11:59:59' group by customers_postcode ORDER BY customers_postcode ASC");

 

// $location_query = tep_db_query("SELECT sum(ot.value) as total, count(*) as count, substring(o.customers_postcode,1,3) as customers_postcode from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot WHERE o.customers_postcode IS NOT NULL and o.date_purchased >= '$year-$startmonth-01 00:00:00' and o.date_purchased <= '$year-$endmonth-31 11:59:59' group by customers_postcode ORDER BY customers_postcode ASC");

 

while ($customers_location = tep_db_fetch_array($location_query)) {

$location_contents .= '<tr class="dataTableRow"><td class="dataTableContent"> <a href="' . FILENAME_STATS_ORDERS_TRACKING_POSTCODES . '?postcode_prefix=' . $customers_location['customers_postcode'] . '&year=' . $year . '&month='. $month . '">' . $customers_location['customers_postcode'] . 'xx</a></font></td><td class="dataTableContent" align="center">' . $customers_location['count'] . '</td></tr>';

}

}

 

echo $location_contents;

?>

 

</table></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table></td>

<!-- body_text_eof //-->

</tr>

</table>

 

<!-- body_eof //-->

 

<!-- footer //-->

 

<!-- footer_eof //-->

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

</body>

</html>

Share this post


Link to post
Share on other sites

Me Again .. LOL

 

 

I finally got it to work. I added some substring commands. Now any Post Codes in the database entered as eg. M4H7J7 are proper to show up as M4H/7J7 .. so now it works with the postalcodedownload.com format.

 

Problem now is to add extra filtering ... because I had some older entries in the database that were entered as eg. M4H-7J7 (which is the way a lot of people enter postcodes to with a hyphen - )

 

I am not that good yet .. LOL I know there are strip specialchars and eregi_replace commands .. etc .... but I do not fully understand their implication yet.

 

 

If anyone wants the working code I have now to look up orders by Zip and Post Code let me know. I will zip this up and put it in contributions for others to improve on.

 

Ideally another feature would be to add a link that shows in each order ... so you can click on the billing addresses post code and have the info popup in a window.

 

 

Well off to bed I am .. darn its late .. or early ..LOL

Share this post


Link to post
Share on other sites

Thanks for all the great work you guys are doing.

 

I have a question about the zipship contibution and its use in Canada.

 

I am using a courier called FastWay here in Ontario. The delivery rates are based on the first three digits of the Postal Code (ie. L4N6K3). My store asks for the customers postal code as 6 digits without room for spaces or hyphens. My question is, how can I make this shipping module work based on only the first three characters of the postal code. Is there a way of using wildcard expressions like L4N*** to cover all the postal codes the begin with L4N for example? Maybe some other way?


I like these mods, there fun! ...65 70 72 75 80 85 125+ contributions installed and counting...

 

Tools I'm using: OSC2.2 milestone2, Filezilla for FTP, PHP Designer 2007PE (nice), Araxis Merge 6.5 to compare files, XP(my box), Remote Server is shared Apache 1.3 Cpanel, CURL, and PHPmyAdmin through my hosts Cpanel to mess up the database.

Share this post


Link to post
Share on other sites

I am not exactly sure what you mean. I took a quick look at the zipship contrib and to answer your question ... Yes I think it would be fairly simple to do.

 

I am wondering why you just want the first three numbers ... ie. for what purpose. Is it to just do a quick lookup of the zone details? ... or maybe are you thinking possibly to have the delivery postcode of the customer as a clickable link? etc.

 

Don't mark my words lol .. I am no master programmer ... but usually can do most things.

 

I think in the modules/zipship.php in the class methods section of code you could do something like this:

 

This Original piece of code would require the additions and alterations.

 

// class methods

function quote($method = '') {

global $order, $shipping_weight, $shipping_num_boxes;

 

$dest_zipcode = $order->delivery['postcode'];

$dest_zone = 0;

$error = false;

 

for ($i=1; $i<=$this->num_zones; $i++) {

$zipcode_table = constant('MODULE_SHIPPING_ZIPSHIP_CODES_' . $i);

$zipcode_zones = split("[,]", $zipcode_table);

if (in_array($dest_zipcode, $zipcode_zones)) {

$dest_zone = $i;

break;

}

}

 

I have modified a contribution called Orders Tracking v2.8b originally developed by Kieth Waldorf. I got playing around and wanted to be able to click on the orders postcode to see the location details ... to have some idea where the customer delivery address was. The original contrib only worked with Zip Codes and not Post Codes.

 

Now right now it is using the ORDERS TABLE customers_postcode. If it were to be integrated in to zipship contrib .. it would make more sense to pull the delivery address post code field like the zipship contrib does for the value of $dest_zipcode

 

If I get time I will play around and try to incorporate mark enriquez great zipship contrib with some of the features of Orders Tracking v2.8b by Kieth Waldorf.

 

I was also thinking it would be cool to list the delivery zip / post code somewhere in admin orders.php so that you could quickly click it to get the details. Possibly even make any post code value clickable ... whether its default, billing or delivery.

 

Well I shut up now LOL

 

:blush:

Share this post


Link to post
Share on other sites
I am not exactly sure what you mean. I took a quick look at the zipship contrib and to answer your question ... Yes I think it would be fairly simple to do.

 

I am wondering why you just want the first three numbers ... ie. for what purpose. Is it to just do a quick lookup of the zone details? ... or maybe are you thinking possibly to have the delivery postcode of the customer as a clickable link? etc.

 

Don't mark my words lol .. I am no master programmer ... but usually can do most things.

 

I think in the modules/zipship.php in the class methods section of code you could do something like this:

 

This Original piece of code would require the additions and alterations.

 

// class methods

function quote($method = '') {

global $order, $shipping_weight, $shipping_num_boxes;

 

$dest_zipcode = $order->delivery['postcode'];

$dest_zone = 0;

$error = false;

 

for ($i=1; $i<=$this->num_zones; $i++) {

$zipcode_table = constant('MODULE_SHIPPING_ZIPSHIP_CODES_' . $i);

$zipcode_zones = split("[,]", $zipcode_table);

if (in_array($dest_zipcode, $zipcode_zones)) {

$dest_zone = $i;

break;

}

}

 

I have modified a contribution called Orders Tracking v2.8b originally developed by Kieth Waldorf. I got playing around and wanted to be able to click on the orders postcode to see the location details ... to have some idea where the customer delivery address was. The original contrib only worked with Zip Codes and not Post Codes.

 

Now right now it is using the ORDERS TABLE customers_postcode. If it were to be integrated in to zipship contrib .. it would make more sense to pull the delivery address post code field like the zipship contrib does for the value of $dest_zipcode

 

If I get time I will play around and try to incorporate mark enriquez great zipship contrib with some of the features of Orders Tracking v2.8b by Kieth Waldorf.

 

I was also thinking it would be cool to list the delivery zip / post code somewhere in admin orders.php so that you could quickly click it to get the details. Possibly even make any post code value clickable ... whether its default, billing or delivery.

 

Well I shut up now LOL

 

:blush:

 

I am delighted that you replied to my post. There doesn't seem to be a thread for the zipship contribution, so I guess this is it now.

Sorry for taking so long to respond, Ihave been very very busy and I neglected to enable email notifications of replies on my last post. Any way.

 

The reason I require ZIPSHIP to use the first three characters of the Canadian postal code is that my local (southern Ontario) shipper determines their area of coverage by the first three characters of the postal code. The postal code is typed into osCommerce the same way as the US zip codes are in the US in terms of its format (example: L4N2H7). I would need to input all of the 234 individual three character codes (example: L1G, K9A, N1P etc.) so the store knows who qualifies for this method of shipping. I will do this by adding the codes to 6 zones, all with the same rate.

(Side Note: This shipping method is 1/3 the cost of any other method available. It is a huge advantage to my new online crack injection grouting store.)

I need to have the store decide if the customer can use Fastway Couriers and return a flat rate of$8.50 CAD for each product ordered that is under 55 lbs. (That is their maximum parcel weight.)

 

Additionally, I will "bundle" common product orders together as an idividual product to make the 55 lbs limit further reducing the shipping cost to my customers.

 

How can i get the zipship mod to only look at the first three characters, and make a decision based on that?

 

This is my first store, please be gentle.

Rod

PS: This time I check the Enable email notification of replies box!


I like these mods, there fun! ...65 70 72 75 80 85 125+ contributions installed and counting...

 

Tools I'm using: OSC2.2 milestone2, Filezilla for FTP, PHP Designer 2007PE (nice), Araxis Merge 6.5 to compare files, XP(my box), Remote Server is shared Apache 1.3 Cpanel, CURL, and PHPmyAdmin through my hosts Cpanel to mess up the database.

Share this post


Link to post
Share on other sites

Hi Guys,

 

I'd just like to say that this contribution is a life saver. I'm just wondering if someone can help me 'tweak' it so that it suits my purposes. I'm using it as a way to offer local delivery to select areas and basically I would like to change three things:

 

1. When the zipcode is not in one of the zones the module just doesn't show up as an option, if this is not possible at least just have it come up saying "Local delivery is not available in your area" instead of having errors and warnings show up everywhere.

 

2. Zone 1 has free shipping at the moment a message comes up saying that the delivery hasn't been able to be worked out which makes it sound as though I might sting these customers with an undisclosed shipping fee, can it just say shipping is free to your area or something.

 

3. I would like to change it so that it says "Local Delivery" instead of "Zipcode" I'm sure that's easy to do just haven't worked out where yet.

 

Before installing Osc I've never worked with php before so I really don't know what I'm doing any help would be greatly appreciated!!!

 

Thanks,

Carol

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×