You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
You will need to use a custom shipping script for all products.
Heres an old script(V7) but I don't think much has change.
https://forum.kryptronic.com/viewtopic.php?id=25119
You will be able to compare it to the custom custom shipping script here Store > Shipping > Custom Shipping Methods to make sure nothing has changed.
Then you will need to add the postcode which are charged at the higher rate
Offline
Hi,
Thanks zanart,
is this possible with a 'custom surcharge' script, like.. if postcode starts with = bla or bla or bla etc. then add £1.00 to total?
then Print "Inner London Surcharge £1.00"
and if so, anyone have any ideas?
Cheers,
Bruce.
Offline
I believe the script in the link I provided pretty much does exactly that.
First of all it breaks down the postcode into the first three or four digits, depending if it is a 6 or 7 digit postcode, and then charges the a different shipping rate based on the postcode.
You can have whatever you want printed on the frontend checkout page to describe the shipping service by editing the script:
Example from script..
$custom = array('Scottish Highlands, UK Isles & Northern Ireland(2-3 Days)' => '19.95');
You can change to
$custom = array('Delivery inc Inner London Surcharge £1.00' => '19.95');
Offline
For a surcharge script, you'll want to grab the postcode from the checkout session instead of custom shipping data. Did you want the billing or delivery postcode to be used for the surchage?
Offline
Would the shipping estimator still work doing it as a surcharge?
Offline
Hi Guys,
Nick, Delivery Postcode always.
It just got a bit more difficult as I have now been handed the postcodes and they are as follows.... With reference to our earlier conversation please find the affected postcodes below.
Postcodes E, EC, N, NW, SE, SW, W, WC
Now these are for central london but.... E also starts Exeter (EX) and other areas etc....
So the Script needs to say... Just E before numbers or EC before numbers.... Not just grabbing the first few digits... It needs to check for numbers after the Letter/s..
Cheers,
Bruce.
Last edited by west4 (09-03-2019 09:20:53)
Offline
webmaster wrote:
zanart wrote:
Would the shipping estimator still work doing it as a surcharge?
No
west4 wrote:
So the Script needs to say... Just E before numbers or EC before numbers.... Not just grabbing the first few digits... It needs to check for numbers after the Letter/s..
Thinking this would all best be done in a custom shipping script and skip the surcharge script. Isolating those postcodes is easy. Isolating the delivery postcode is very easy too, within a custom shipping script. How is shipping set up now for your inventory items?
Offline
Hi,
I have 10 different custom shipping scripts, so I was thinking if it was just a check-up at the beginning of the script then added the amount if needed It would be easier to just duplicate the code to the other scripts.
Here is an example script.
<?php $info = $this->globals('ecom.customship'); // +-- // | UK - England & Wales // +-- if ($info['country'] == 'UK - England & Wales') { ($weight = $info['weight'] + 0.5); if ($weight <= 5.00) {$total = '6.76'; $method = 'Weight Based Shipping to England & Wales';} elseif ($weight <= 9.99) {$total = '8.84'; $method = 'Weight Based Shipping to England & Wales';} elseif ($weight <= 14.99) {$total = '10.92'; $method = 'Weight Based Shipping to England & Wales';} elseif ($weight <= 24.99) {$total = '13.00'; $method = 'Weight Based Shipping to England & Wales';} elseif ($weight <= 34.99) {$total = '16.12'; $method = 'Weight Based Shipping to England & Wales';} elseif ($weight <= 44.99) {$total = '19.24'; $method = 'Weight Based Shipping to England & Wales';} elseif ($weight <= 54.99) {$total = '22.36'; $method = 'Weight Based Shipping to England & Wales';} elseif ($weight <= 64.99) {$total = '24.44'; $method = 'Weight Based Shipping to England & Wales';} else {$total = '0.00'; $method = 'FOR POSTAGE QUOTE, Contact Westfield4Schools on 0121 233 1671';} $custom = array($method => $total); } // +-- // | UK - Scotland Lowlands // +-- elseif ($info['country'] == 'UK - Scotland Lowlands') { $weight = $info['weight'] + 0.5; if ($weight <= 5.00) {$total = '8.27'; $method = 'Weight Based Shipping to Scotland Lowlands';} elseif ($weight <= 9.99) {$total = '9.88'; $method = 'Weight Based Shipping to Scotland Lowlands';} elseif ($weight <= 14.99) {$total = '13.00'; $method = 'Weight Based Shipping to Scotland Lowlands';} elseif ($weight <= 24.99) {$total = '15.08'; $method = 'Weight Based Shipping to Scotland Lowlands';} elseif ($weight <= 34.99) {$total = '18.20'; $method = 'Weight Based Shipping to Scotland Lowlands';} elseif ($weight <= 44.99) {$total = '21.32'; $method = 'Weight Based Shipping to Scotland Lowlands';} elseif ($weight <= 54.99) {$total = '24.44'; $method = 'Weight Based Shipping to Scotland Lowlands';} elseif ($weight <= 64.99) {$total = '26.52'; $method = 'Weight Based Shipping to Scotland Lowlands';} else {$total = '00.00'; $method = 'FOR POSTAGE QUOTE, Contact Westfield4Schools on 0121 233 1671';} $custom = array($method => $total); } // +-- // | UK - Scotland Highlands // +-- elseif ($info['country'] == 'UK - Scotland Highlands') { $weight = $info['weight'] + 0.5; if ($weight <= 5.00) {$total = '9.82'; $method = 'Weight Based Shipping to Scotland Highlands';} elseif ($weight <= 9.99) {$total = '12.48'; $method = 'Weight Based Shipping to Scotland Highlands';} elseif ($weight <= 14.99) {$total = '15.60'; $method = 'Weight Based Shipping to Scotland Highlands';} elseif ($weight <= 24.99) {$total = '17.68'; $method = 'Weight Based Shipping to Scotland Highlands';} elseif ($weight <= 34.99) {$total = '20.80'; $method = 'Weight Based Shipping to Scotland Highlands';} elseif ($weight <= 44.99) {$total = '23.92'; $method = 'Weight Based Shipping to Scotland Highlands';} elseif ($weight <= 54.99) {$total = '27.04'; $method = 'Weight Based Shipping to Scotland Highlands';} elseif ($weight <= 64.99) {$total = '29.12'; $method = 'Weight Based Shipping to Scotland Highlands';} else {$total = '00.00'; $method = 'FOR POSTAGE QUOTE, Contact Westfield4Schools on 0121 233 1671';} $custom = array($method => $total); } // +-- // | Rest Of The World // +-- else { $method = 'FOR POSTAGE QUOTE, Contact Westfield4Schools on 0121 233 1671'; $total = '00.00'; $custom = array($method => $total); } // End of if statement. $this->globals('ecom.customship_response',$custom); ?>
Maybe a bit like this...
<?php // +-- // | All custom shipping scripts work in the same way. A global // | variable named 'ecom.customship' contains the following PHP // | array. Array keys with value info: // | // | weight => Total weight of items being shipped. // | total => Subtotal of items being shipped. // | quantity => Quantity of items being shipped. // | stateprov => Ship to state/province. // | country => Ship to country. // | postalcode => Ship to postal code. // | rescom => Ship to residential/commercial status. // | shipstateprov => Ship origin state/province. // | shipcountry => Ship origin country. // | shipzip => Ship origin postal code. // | packages => An array containing all packages with // | each package defined in it's own array // | with keys: length, width, height, weight. // | delinfo => Delivery information array. // | delitems => An array containing all items with // | each item id as a key and the item quantity // | as a value. // | // | This script must set a global variable named // | 'ecom.customship_response' which is an array in the // | following format: // | // | method name => amount // | // | NOTE: Do not print anything within custom shipping // | scripts. They are designed only to return names and // | prices for custom shipping methods. // | // | This script is a Percentage of Total Item Cost script that // | returns a prices based on a percentage of the total item cost. // +-- $info = $this->globals('ecom.customship'); //Bruces bit $shipquantity = $info['quantity']; $shippostcode = $info['postalcode']; $ordertotal = $info['total']; //Change to Uppercase $shippostcode = strtoupper($shippostcode); //remove white space $postcode = preg_replace( '/[^a-z0-9]/i', '', $shippostcode ); // If length is acceptable, just remove the last three characters to make a 3 or 4 digit postcode if ( in_array( strlen( $postcode ), array( 5, 6, 7 ) ) ) {$postcode = substr( $postcode, 0, -3 );} //Deal with london postcode surcharge if (( preg_match( '/AL\d{1,2}/i', $postcode ))||( preg_match( '/EN\d{1,2}/i', $postcode ))||( preg_match( '/HP\d{1,2}/i', $postcode ))||( preg_match( '/LU\d{1,2}/i', $postcode ))||( preg_match( '/MK\d{1,2}/i', $postcode ))||( preg_match( '/SG\d{1,2}/i', $postcode ))||( preg_match( '/SG\d{1,2}/i', $postcode ))){$custom = array('Inner London Surcharge' => '1.00');} //end of bruces bit elseif (($info['country'] == 'UK - England & Wales')){ //England & Wales $method = 'Badge Shipping to England & Wales'; $quantity = $info['quantity']; if ($quantity >= 1 and $quantity <= 499) { $total = '10.40'; } if ($quantity >= 500 and $quantity <= 999) { $total = '11.96'; } if ($quantity >= 1000 and $quantity <= 2000) { $total = '14.04'; } if ($quantity >= 2001) { $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671..'; $total = '0.00'; } $custom = array($method => $total); } elseif (($info['country'] == 'UK - Scotland Lowlands')){ // UK Scotland Lowlands $method = 'Badge Shipping to Scottish Lowlands'; $quantity = $info['quantity']; if ($quantity >= 1 and $quantity <= 499) { $total = '12.48'; } if ($quantity >= 500 and $quantity <= 999) { $total = '14.04'; } if ($quantity >= 1000 and $quantity <= 2000) { $total = '16.12'; } if ($quantity >= 2001) { $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671..'; $total = '0.00'; } $custom = array($method => $total); } elseif (($info['country'] == 'UK - Scotland Highlands')){ // UK - Scotland Highlands $method = 'Badge Shipping to Scotland Highlands'; $quantity = $info['quantity']; if ($quantity >= 1 and $quantity <= 499) { $total = '14.56'; } if ($quantity >= 500 and $quantity <= 999) { $total = '16.12'; } if ($quantity >= 1000 and $quantity <= 2000) { $total = '18.20'; } if ($quantity >= 2001) { $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671..'; $total = '0.00'; } $custom = array($method => $total); } elseif (($info['country'] == 'UK - Scotland Islands')){ // UK - Scotland Islands $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671.'; $total = '0.00'; $custom = array($method => $total); } elseif (($info['country'] == 'UK - Channel Islands')){ // UK Channel Islands $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671.'; $total = '0.00'; $custom = array($method => $total); } elseif (($info['country'] == 'UK - Northern Ireland')){ // UK Northern Ireland $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671.'; $total = '0.00'; $custom = array($method => $total); } else { // Rest of the world $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671.'; $total = '0.00'; $custom = array($method => $total); } $this->globals('ecom.customship_response',$custom); ?>
Cheers,
Bruce.
Last edited by west4 (09-04-2019 10:22:44)
Offline
Why have you got 10 shipping scripts(not suggesting there is anything wrong, but it must be complicated to manage)??
With a custom shipping script, it is easy to break the country up by postcode areas - providing you get the correct information from your courier.
This eliminates the need to allow the user to select between Scottish Lowlands and Scottish Highlands, as typically they will select the cheaper delivery option.
I only have United Kingdom which includes anyway with a postcode, and republic of ireland. The custom script charges the correct delivery rate based solely on the postcode. The country selection only gets involved if they select Ireland.
Where you have put 'Inner London Surcharge' => '1.00', that would be the delivery method and total charge for delivery to those postcode areas. It wouldn't add a surcharge of £1 to any other delivery charge.
Offline
Hi Zanart,
We have two shippers that charge different prices, and also multiple versions of the two prices, so it has become over the years 10 scripts. examples: 1 shipper, charges for box size plus weight, also volume, also volume plus weight, also just weight, also just box size, also next day premium or normal fee etc. then we have out sourced products that require their own shipping pricing on some products, none of which are customer choose-able, so we need to show the shipping at checkout without choice.
When we sell water bottles we ship 400 in 8 boxes but they weigh very little but have a large volume in the back of the van so they charge us for volume surcharge plus weight, but when we ship rulers we are charged for weight in a standard sized box. Different pricings. etc.
The easiest way to deal with this was to clone a shipping script and adjust pricings and allocate that script to the awkward product.
I need a surcharge added to normal delivery prices system according to post code. I thought adding it to the top and sorting postcodes first then applying a surcharge 'IF; would be the easy way?
[img]https://madein-uk.com/images/Screen Shot 2019-09-05 at 09.29.17.png[/img]
Cheers,
Bruce.
Last edited by west4 (09-05-2019 03:32:07)
Offline
Hi,
So I have this, and it's kind of working.
//Deal with london postcode surcharge if (( preg_match( '/EC\d{1,2}/i', $postcode ))||( preg_match( '/NW\d{1,2}/i', $postcode ))||( preg_match( '/SE\d{1,2}/i', $postcode ))||( preg_match( '/SW\d{1,2}/i', $postcode ))||( preg_match( '/WC\d{1,2}/i', $postcode ))||( preg_match( '/E\d{1,2}/i', $postcode ))||( preg_match( '/N\d{1,2}/i', $postcode ))){$custom = array('Inner London Surcharge' => '1.0',);} //end of Bruces bit elseif (($info['country'] == 'UK - England & Wales')){ //England & Wales $method = 'Badge Shipping to England & Wales'; $quantity = $info['quantity']; if ($quantity >= 1 and $quantity <= 499) { $total = '10.40'; }
I just need a bit of code to say add $total and $custom together and display as shipping cost.
Cheers,
Bruce.
Last edited by west4 (09-05-2019 09:16:22)
Offline
Hi Nick,
so I added it like this..
//Bruces bit $shipquantity = $info['quantity']; $shippostcode = $info['postalcode']; $ordertotal = $info['total']; //Change to Uppercase $shippostcode = strtoupper($shippostcode); //remove white space $postcode = preg_replace( '/[^a-z0-9]/i', '', $shippostcode ); // If length is acceptable, just remove the last three characters to make a 3 or 4 digit postcode if ( in_array( strlen( $postcode ), array( 5, 6, 7 ) ) ) {$postcode = substr( $postcode, 0, -3 );} //Deal with london postcode surcharge if (( preg_match( '/EC\d{1,2}/i', $postcode ))||( preg_match( '/NW\d{1,2}/i', $postcode ))||( preg_match( '/SE\d{1,2}/i', $postcode ))||( preg_match( '/SW\d{1,2}/i', $postcode ))||( preg_match( '/WC\d{1,2}/i', $postcode ))||( preg_match( '/E\d{1,2}/i', $postcode ))||( preg_match( '/N\d{1,2}/i', $postcode ))){$custom = array('Inner London Surcharge' => '1.0',);} $this->globals('ecom.customship_response',array($method => $total)); //end of Bruces bit
But now it shows shipping but doesn't add the surcharge, or show the surcharge either.
Should it not be "$total + $custom" or something like that?
Cheers,
Bruce.
Last edited by west4 (09-10-2019 03:25:29)
Offline
Because you're defining a custom array:
if (( preg_match( '/EC\d{1,2}/i', $postcode ))||( preg_match( '/NW\d{1,2}/i', $postcode ))||( preg_match( '/SE\d{1,2}/i', $postcode ))||( preg_match( '/SW\d{1,2}/i', $postcode ))||( preg_match( '/WC\d{1,2}/i', $postcode ))||( preg_match( '/E\d{1,2}/i', $postcode ))||( preg_match( '/N\d{1,2}/i', $postcode ))){$custom = array('Inner London Surcharge' => '1.0',);}
Do this:
$this->globals('ecom.customship_response',$custom);
Offline
Hi Nick,
This doesn't work.
....... preg_match( '/N\d{1,2}/i', $postcode ))){$custom = array('Inner London Surcharge' => '1.0',);} $this->globals('ecom.customship_response',$custom);
It just shows normal delivery price and description.
Cheers,
Bruce.
Offline
Hi Nick,
Here
<?php // +-- // | All custom shipping scripts work in the same way. A global // | variable named 'ecom.customship' contains the following PHP // | array. Array keys with value info: // | // | weight => Total weight of items being shipped. // | total => Subtotal of items being shipped. // | quantity => Quantity of items being shipped. // | stateprov => Ship to state/province. // | country => Ship to country. // | postalcode => Ship to postal code. // | rescom => Ship to residential/commercial status. // | shipstateprov => Ship origin state/province. // | shipcountry => Ship origin country. // | shipzip => Ship origin postal code. // | packages => An array containing all packages with // | each package defined in it's own array // | with keys: length, width, height, weight. // | delinfo => Delivery information array. // | delitems => An array containing all items with // | each item id as a key and the item quantity // | as a value. // | // | This script must set a global variable named // | 'ecom.customship_response' which is an array in the // | following format: // | // | method name => amount // | // | NOTE: Do not print anything within custom shipping // | scripts. They are designed only to return names and // | prices for custom shipping methods. // | // | This script is a Percentage of Total Item Cost script that // | returns a prices based on a percentage of the total item cost. // +-- $info = $this->globals('ecom.customship'); //Bruces bit $shipquantity = $info['quantity']; $shippostcode = $info['postalcode']; $ordertotal = $info['total']; //Change to Uppercase $shippostcode = strtoupper($shippostcode); //remove white space $postcode = preg_replace( '/[^a-z0-9]/i', '', $shippostcode ); // If length is acceptable, just remove the last three characters to make a 3 or 4 digit postcode if ( in_array( strlen( $postcode ), array( 5, 6, 7 ) ) ) {$postcode = substr( $postcode, 0, -3 );} //Deal with london postcode surcharge if (( preg_match( '/EC\d{1,2}/i', $postcode ))||( preg_match( '/NW\d{1,2}/i', $postcode ))||( preg_match( '/SE\d{1,2}/i', $postcode ))||( preg_match( '/SW\d{1,2}/i', $postcode ))||( preg_match( '/WC\d{1,2}/i', $postcode ))||( preg_match( '/E\d{1,2}/i', $postcode ))||( preg_match( '/N\d{1,2}/i', $postcode ))){$custom = array('Inner London Surcharge' => '1.0',);} $this->globals('ecom.customship_response',$custom); //end of Bruces bit if (($info['country'] == 'UK - England & Wales')){ //England & Wales $method = 'Badge Shipping to England & Wales'; $quantity = $info['quantity']; if ($quantity >= 1 and $quantity <= 499) { $total = '10.40'; } if ($quantity >= 500 and $quantity <= 999) { $total = '11.96'; } if ($quantity >= 1000 and $quantity <= 2000) { $total = '14.04'; } if ($quantity >= 2001) { $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671..'; $total = '0.00'; } $custom = array($method => $total); } elseif (($info['country'] == 'UK - Scotland Lowlands')){ // UK Scotland Lowlands $method = 'Badge Shipping to Scottish Lowlands'; $quantity = $info['quantity']; if ($quantity >= 1 and $quantity <= 499) { $total = '12.48'; } if ($quantity >= 500 and $quantity <= 999) { $total = '14.04'; } if ($quantity >= 1000 and $quantity <= 2000) { $total = '16.12'; } if ($quantity >= 2001) { $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671..'; $total = '0.00'; } $custom = array($method => $total); } elseif (($info['country'] == 'UK - Scotland Highlands')){ // UK - Scotland Highlands $method = 'Badge Shipping to Scotland Highlands'; $quantity = $info['quantity']; if ($quantity >= 1 and $quantity <= 499) { $total = '14.56'; } if ($quantity >= 500 and $quantity <= 999) { $total = '16.12'; } if ($quantity >= 1000 and $quantity <= 2000) { $total = '18.20'; } if ($quantity >= 2001) { $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671..'; $total = '0.00'; } $custom = array($method => $total); } elseif (($info['country'] == 'UK - Scotland Islands')){ // UK - Scotland Islands $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671.'; $total = '0.00'; $custom = array($method => $total); } elseif (($info['country'] == 'UK - Channel Islands')){ // UK Channel Islands $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671.'; $total = '0.00'; $custom = array($method => $total); } elseif (($info['country'] == 'UK - Northern Ireland')){ // UK Northern Ireland $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671.'; $total = '0.00'; $custom = array($method => $total); } else { // Rest of the world $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671.'; $total = '0.00'; $custom = array($method => $total); } $this->globals('ecom.customship_response',$custom); ?>
This is just one of a few.
Cheers,
Bruce.
Offline
If I understand correctly, your issue is with:
//Deal with london postcode surcharge if (( preg_match( '/EC\d{1,2}/i', $postcode ))||( preg_match( '/NW\d{1,2}/i', $postcode ))||( preg_match( '/SE\d{1,2}/i', $postcode ))||( preg_match( '/SW\d{1,2}/i', $postcode ))||( preg_match( '/WC\d{1,2}/i', $postcode ))||( preg_match( '/E\d{1,2}/i', $postcode ))||( preg_match( '/N\d{1,2}/i', $postcode ))){$custom = array('Inner London Surcharge' => '1.0',);} $this->globals('ecom.customship_response',$custom); //end of Bruces bit if (($info['country'] == 'UK - England & Wales')){ //England & Wales $method = 'Badge Shipping to England & Wales'; $quantity = $info['quantity'];
Change to:
//Deal with london postcode surcharge if (( preg_match( '/EC\d{1,2}/i', $postcode ))||( preg_match( '/NW\d{1,2}/i', $postcode ))||( preg_match( '/SE\d{1,2}/i', $postcode ))||( preg_match( '/SW\d{1,2}/i', $postcode ))||( preg_match( '/WC\d{1,2}/i', $postcode ))||( preg_match( '/E\d{1,2}/i', $postcode ))||( preg_match( '/N\d{1,2}/i', $postcode ))){ $custom = array('Inner London Surcharge' => '1.0',); } elseif (($info['country'] == 'UK - England & Wales')){ //England & Wales $method = 'Badge Shipping to England & Wales'; $quantity = $info['quantity'];
Offline
Hi All,
I think we are working on different things,
I need an additional charge ADDED to the shipping total if the postcode matches, not just a total if postcode matches.
So a bit of code that adds a surcharge to the total, not just replacing the total with another one, It needs to do the math..
With a normal shipping script but 'if Postcode matches' ADD surcharge to 'normal shipping total' and display TOTAL + SURCHARGE.
This is for volume and variable scripts so adding just one Surcharge total in the script is not going to work.
Hope this clarifies it a bit more.
Cheers,
Bruce.
Offline
Try this. Reading it was hard, so I reformatted it as well:
<?php // +-- // | All custom shipping scripts work in the same way. A global // | variable named 'ecom.customship' contains the following PHP // | array. Array keys with value info: // | // | weight => Total weight of items being shipped. // | total => Subtotal of items being shipped. // | quantity => Quantity of items being shipped. // | stateprov => Ship to state/province. // | country => Ship to country. // | postalcode => Ship to postal code. // | rescom => Ship to residential/commercial status. // | shipstateprov => Ship origin state/province. // | shipcountry => Ship origin country. // | shipzip => Ship origin postal code. // | packages => An array containing all packages with // | each package defined in it's own array // | with keys: length, width, height, weight. // | delinfo => Delivery information array. // | delitems => An array containing all items with // | each item id as a key and the item quantity // | as a value. // | // | This script must set a global variable named // | 'ecom.customship_response' which is an array in the // | following format: // | // | method name => amount // | // | NOTE: Do not print anything within custom shipping // | scripts. They are designed only to return names and // | prices for custom shipping methods. // | // | This script is a Percentage of Total Item Cost script that // | returns a prices based on a percentage of the total item cost. // +-- $info = $this->globals('ecom.customship'); $method = 'Standard Shipping'; $total = 0.00; // +-- // | England & Wales // +-- if ($info['country'] == 'UK - England & Wales') { if ($info['quantity'] <= 499) { $method = 'Badge Shipping to England & Wales'; $total = 10.40; } elseif ($info['quantity'] >= 500 && $info['quantity'] <= 999) { $method = 'Badge Shipping to England & Wales'; $total = 11.96; } elseif ($info['quantity'] >= 1000 && $info['quantity'] <= 2000) { $method = 'Badge Shipping to England & Wales'; $total = 14.04; } else { $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671'; $total = 0.00; } // End of if statement. // +-- // | UK Scotland Lowlands // +-- } elseif ($info['country'] == 'UK - Scotland Lowlands'){ if ($info['quantity'] <= 499) { $method = 'Badge Shipping to Scottish Lowlands'; $total = 12.48; } elseif ($info['quantity'] >= 500 && $info['quantity'] <= 999) { $method = 'Badge Shipping to Scottish Lowlands'; $total = 14.04; } elseif ($info['quantity'] >= 1000 && $info['quantity'] <= 2000) { $method = 'Badge Shipping to Scottish Lowlands'; $total = 16.12; } else { $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671'; $total = 0.00; } // End of if statement. // +-- // | UK - Scotland Highlands // +-- } elseif ($info['country'] == 'UK - Scotland Highlands'){ if ($info['quantity'] <= 499) { $method = 'Badge Shipping to Scotland Highlands'; $total = 14.56; } elseif ($info['quantity'] >= 500 && $info['quantity'] <= 999) { $method = 'Badge Shipping to Scotland Highlands'; $total = 16.12; } elseif ($info['quantity'] >= 1000 && $info['quantity'] <= 2000) { $method = 'Badge Shipping to Scotland Highlands'; $total = 18.20; } else { $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671'; $total = 0.00; } // End of if statement. // +-- // | UK - Scotland Islands // +-- } elseif ($info['country'] == 'UK - Scotland Islands'){ $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671'; $total = 0.00; // +-- // | UK - Channel Islands // +-- } elseif ($info['country'] == 'UK - Channel Islands'){ $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671'; $total = 0.00; // +-- // | UK Northern Ireland // +-- } elseif ($info['country'] == 'UK - Northern Ireland'){ $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671'; $total = '0.00'; // +-- // | Rest of the world // +-- } else { $method = 'For Delivery Quote, contact Westfield4Schools on 0121 233 1671'; $total = 0.00; } // End of if statement. // +-- // | Surcharge // +-- $shipquantity = $info['quantity']; $shippostcode = $info['postalcode']; $ordertotal = $info['total']; $shippostcode = strtoupper($shippostcode); $postcode = preg_replace( '/[^a-z0-9]/i', '', $shippostcode ); if ( in_array( strlen( $postcode ), array( 5, 6, 7 ) ) ) {$postcode = substr( $postcode, 0, -3 );} if (( preg_match( '/EC\d{1,2}/i', $postcode ))||( preg_match( '/NW\d{1,2}/i', $postcode ))||( preg_match( '/SE\d{1,2}/i', $postcode ))||( preg_match( '/SW\d{1,2}/i', $postcode ))||( preg_match( '/WC\d{1,2}/i', $postcode ))||( preg_match( '/E\d{1,2}/i', $postcode ))||( preg_match( '/N\d{1,2}/i', $postcode ))) { $method .= ' with Inner London Surcharge'; $total += 1.00; } // End of if statement. // +-- // | Globalize // +-- $custom = array($method => $total); $this->globals('ecom.customship_response',$custom); ?>
Offline
Hi Nick,
That's it.. Whoo Hoo!.. It works fine, copied it to the bottom of all scripts and the few I have tried all worked...:-)
Big Cheers,
Bruce.
Offline
Hi Nick,
Spoke too soon.
It is picking any post code with any of the London Surcharge letters in the first 3 characters, damn.. I only tested with the first 2 characters.
Is there any way it can look for "State/Province* = London" first, then check for the postcode letters. so other counties (State/Province*) don't get caught up in this.
Cheers,
Bruce.
Offline