Re: ZipShip - Support Thread
Don't know if this mod will do what I want. We deliver with our own trucks locally and want to charge extra for locations with postal codes that are farther away. So all customers in our area pay $10.00 shipping and others by specifying the postal codes pay $15.00. Hopefully i don't have to enter all the postal codes in my area and hoping that there is a default setting.
Thanks!!!
Re: ZipShip - Support Thread
Quote:
Originally Posted by
allmart
Don't know if this mod will do what I want. We deliver with our own trucks locally and want to charge extra for locations with postal codes that are farther away. So all customers in our area pay $10.00 shipping and others by specifying the postal codes pay $15.00. Hopefully i don't have to enter all the postal codes in my area and hoping that there is a default setting.
Thanks!!!
You would (unfortunately) have to enter all the postal codes that are 'local' into the Zip Code List for one ZipShip Zone and enter 00000 as the Zip Code list for the other (out of range). Set the Calculation Method to Items and then enter the first Zones' Shipping Table as 9999:10 and the second one as 9999:15.
That will identify a $10.00 flat-rate shipping for the 'local' postal codes and $15.00 flat-rate shipping for further ones.
Re: ZipShip - Support Thread
Hi lat9,
Thanks for the replies. The problem I am having is that the format of my Canadian postal codes have a space between then(L4H 5A1 for example). Where in your wonderful code can I put the code to replace/remove the spaces, specifics will be appreciated.
Thanks in Advance!!!
Re: ZipShip - Support Thread
Never mind,
I figured it out I changed
$this->dest_zipcode = substr(strtoupper($order->delivery['postcode']), 0, (int)ENTRY_POSTCODE_MIN_LENGTH);
to
$this->dest_zipcode = substr(strtoupper(str_replace(' ', '',$order->delivery['postcode'])), 0, (int)ENTRY_POSTCODE_MIN_LENGTH);
which is working.
Great mod, don't know why I didn't find it sooner.
Thanks lat9!!!
Re: ZipShip - Support Thread
Quote:
Originally Posted by
allmart
Hi lat9,
Thanks for the replies. The problem I am having is that the format of my Canadian postal codes have a space between then(L4H 5A1 for example). Where in your wonderful code can I put the code to replace/remove the spaces, specifics will be appreciated.
Thanks in Advance!!!
That shouldn't be an issue, so long as the minimum postcode length is set to 7, although some customers will enter that without the space.
Starting at line 63 of /includes/modules/shipping/zipship.php
Code:
// -----
// Gather the destination's zipcode, uppercasing and then truncating to the store's minimum zipcode length.
//
// NOTE: I'm counting on the address-book generation logic for the store to have properly ensured that the
// postcode entered is at least the minimum-length configured!
//
$this->dest_zone = false;
$this->default_zone = false;
$this->dest_zipcode = substr(strtoupper($order->delivery['postcode']), 0, (int)ENTRY_POSTCODE_MIN_LENGTH);
for ($i = 1; $i <= $this->num_zones; $i++) {
$current_table = "MODULE_SHIPPING_ZIPSHIP_CODES_$i";
if (defined($current_table)) {
$zipcode_table = constant($current_table);
if ($zipcode_table === '00000') {
$this->default_zone = $i;
} else {
$zipcode_zones = explode(',', strtoupper($zipcode_table));
if (in_array($this->dest_zipcode, $zipcode_zones)) {
$this->dest_zone = $i;
}
}
}
}
... make the highlighted changes:
Code:
// -----
// Gather the destination's zipcode, uppercasing and then truncating to the store's minimum zipcode length.
//
// NOTE: I'm counting on the address-book generation logic for the store to have properly ensured that the
// postcode entered is at least the minimum-length configured!
//
$this->dest_zone = false;
$this->default_zone = false;
$this->dest_zipcode = substr(strtoupper(str_replace(' ', '', $order->delivery['postcode'])), 0, (int)ENTRY_POSTCODE_MIN_LENGTH);
for ($i = 1; $i <= $this->num_zones; $i++) {
$current_table = "MODULE_SHIPPING_ZIPSHIP_CODES_$i";
if (defined($current_table)) {
$zipcode_table = constant($current_table);
if ($zipcode_table === '00000') {
$this->default_zone = $i;
} else {
$zipcode_zones = explode(',', strtoupper(str_replace(' ', '', $zipcode_table)));
if (in_array($this->dest_zipcode, $zipcode_zones)) {
$this->dest_zone = $i;
}
}
}
}
Re: ZipShip - Support Thread
Much better, Thanks!
Don't suppose there is a way to use wildcards in the postal code list. With most of my postal codes I only need the first 3 characters. There are a lot of variations.
Re: ZipShip - Support Thread
Quote:
Originally Posted by
allmart
Much better, Thanks!
Don't suppose there is a way to use wildcards in the postal code list. With most of my postal codes I only need the first 3 characters. There are a lot of variations.
In that section posted above, instead of using in_array to find matches, you could use a foreach loop to check for a match on the start.
Re: ZipShip - Support Thread
Thanks lat9 but that's over my head, your guidance is appreciated
Re: ZipShip - Support Thread
Given that you said you only care about first 3 characters, you could maybe even use this additional change which only matches on the customer's first 3 supplied postal code characters:
Code:
} else {
$zipcode_zones = explode(',', strtoupper(str_replace(' ', '', $zipcode_table)));
if (in_array(substr($this->dest_zipcode, 0, 3), $zipcode_zones)) {
$this->dest_zone = $i;
}
}
... and then only define 3-char patterns in the module's list of supported postal codes.
Re: ZipShip - Support Thread
Thanks DrByte,
This is the dilemma I'm facing. There are 124,000 area codes in the area we deliver. I recently discovered that if I only went with the first 3 characters of the postal codes I will lose the ability to charge extra for customers that are further away which are located by the last 3 characters of the postal codes (6 alpha/numeric characters in Canada). We are located in in Toronto, all the postal codes are prefixed with "M" and we deliver to all of them. The surrounding immediate surrounding are prefix with "L" and some are in our near vicinity, some we don't deliver to at all (too far) and some I want to if I can charge extra. This is why I was hoping to have the ability to use wild cards. M***** would cover all my postal codes in Toronto and say L4**** would cover all postal codes that have that prefix ... and so on.
One problem I anticipate is that there are postal codes with the same prefix that I don't want to deliver to at all. For example if I put L7E in my postal codes for Zone1 but I don't want to deliver to postal code L7E1H7, will it not give me the rate for Zone1 instead of telling the customer that we don't deliver to their area.
Unfortunately there is a limit of how many postal codes can be entered approximately 9,600. Is there a way to increase the limit so I can use zipship the hardway which I am more than happy with.
Don't know if there is an easy solution to my problem and would appreciate any suggestions.