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.
I have a site that is currently live and i need to add shipping out side the UK to it
i am currently using shipping by quantity and amended the script so it works for the UK
But i can't add other countries, i need to be able to set another set of shipping rates for everywhere that is not the UK
the script i am currently using is as follows
$info = $this->globals('ecom.customship');
$quantity = $info['quantity'];
$total = $info['total'];
if ($quantity<= '2'){
$custom = array('Standard Carrier 1 to 2' => '3.25');
}
if ($quantity >= '3' and $quantity <= 4) {
$custom = array('Standard Carrier 3 to 4' => '5.00');
}
if ($quantity >= '5' and $quantity <= 6) {
$custom = array('Standard Carrier 5 to 6' => '6.50');
}
if ($quantity >= 7) {
$total = 6.75;
$custom = array('Standard Carrier 7+' => $total);
}
$this->globals('ecom.customship_response',$custom);
?>
can someone point me in the right direction.. i have tried amending a script that was written for by weight and got nowhere apart from a fried head
Cheers
DHLX
Offline
This has only two examples for UK area shipping, you can add more and you would need to add the code for shipping amounts for the rest of the world saying that your not going to very the rate for different countries, if so you would need to include an else if statement for that area.
<?php $info = $this->globals('ecom.customship'); $quantity = $info['quantity']; $total = $info['total']; if (($info['country'] == 'UK - England & Wales') || ($info['country'] == 'UK - Channel Islands')) { if ($quantity<= '2'){ $custom = array('Standard Carrier 1 to 2' => '3.25'); } if ($quantity >= '3' and $quantity <= 4) { $custom = array('Standard Carrier 3 to 4' => '5.00'); } if ($quantity >= '5' and $quantity <= 6) { $custom = array('Standard Carrier 5 to 6' => '6.50'); } if ($quantity >= 7) { $total = 6.75; $custom = array('Standard Carrier 7+' => $total); } } esle { // The rest of the world shipping code. } // end of if statement. $this->globals('ecom.customship_response',$custom); ?>
John
Last edited by dh783 (11-01-2010 14:00:52)
Offline
Hi
would i be able to have the rest of the world shipping based on quantity like i do for the UK?
and if so would i need to specify all the countries that we ship to in the if statements like at the start of the UK shipping?
this has mashed my head for a couple of days now...
Offline
also meant to say thank you for helping
Offline
In the example I gave any country that isn't in the first if statement
if (($info['country'] == 'UK - England & Wales') || ($info['country'] == 'UK - Channel Islands')) {
would go to the else part of the statement. If you want different shipping amounts for different countries then they would need there own statements like
if (($info['country'] == 'UK - England & Wales') || ($info['country'] == 'UK - Channel Islands')) { // shipping for this area } else if ($info['country'] == 'Another Country') { // shipping for this area } else if ($info['country'] == 'Another Country') { // shipping for this area } else { // this will catch any country that doesn't have a if statement of its own. } // End of if statement.
and yes you can calculate the shipping by quantity the same as in your original code, just change the amount you want to charge.
John
Offline
Cheers John
I will have a play after i have eaten... coding hurts my head
Ivor
Offline
My brain is now dribbling out of my ear with this
here is the code i have, i have amended it so many time that don't know what is right or wrong anymore
Please could you take a look it would be a great help
<?php
$info = $this->globals('ecom.customship');
$quantity = $info['quantity'];
$total = $info['total'];
if (($info['country'] == 'UK - England & Wales') || ($info['country'] == 'UK - Channel Islands')) {
if ($quantity<= '2'){
$custom = array('Standard Carrier 1 to 2' => '3.25');
}
if ($quantity >= '3' and $quantity <= 4) {
$custom = array('Standard Carrier 3 to 4' => '5.00');
}
if ($quantity >= '5' and $quantity <= 6) {
$custom = array('Standard Carrier 5 to 6' => '6.50');
}
if ($quantity >= 7) {
$total = 6.75;
$custom = array('Standard Carrier 7+' => $total);
} elseif ($info['country'] == 'Ireland' ||
$info['country'] == 'Cyprus' ||
$info['country'] == 'Gibraltar' ||
$info['country'] == 'San Marino' ||
$info['country'] == 'Slovenia' ||
$info['country'] == 'Switzerland' ||
$info['country'] == 'Austria' ||
$info['country'] == 'Belgium' ||
$info['country'] == 'Denmark' ||
$info['country'] == 'France' ||
$info['country'] == 'Germany' ||
$info['country'] == 'Greece' ||
$info['country'] == 'Italy' ||
$info['country'] == 'Luxembourg' ||
$info['country'] == 'Netherlands' ||
$info['country'] == 'Portugal' ||
$info['country'] == 'Spain' ||
$info['country'] == 'Sweden') {
if ($quantity<= '2'){
$custom = array('Standard Carrier 1 to 2' => '5.25');
}
if ($quantity >= '3' and $quantity <= 4) {
$custom = array('Standard Carrier 3 to 4' => '7.00');
}
if ($quantity >= '5' and $quantity <= 6) {
$custom = array('Standard Carrier 5 to 6' => '8.50');
}
if ($quantity >= 7) {
$total = 9.75;
$custom = array('Standard Carrier 7+' => $total);
$this->globals('ecom.customship_response',$custom);
?>
Many many thanks in advance
Offline
You were missing 3 closing braces on if statements.
<?php $info = $this->globals('ecom.customship'); $quantity = $info['quantity']; $total = $info['total']; if (($info['country'] == 'UK - England & Wales') || ($info['country'] == 'UK - Channel Islands')) { if ($quantity<= '2'){ $custom = array('Standard Carrier 1 to 2' => '3.25'); } if ($quantity >= '3' and $quantity <= 4) { $custom = array('Standard Carrier 3 to 4' => '5.00'); } if ($quantity >= '5' and $quantity <= 6) { $custom = array('Standard Carrier 5 to 6' => '6.50'); } if ($quantity >= 7) { $total = 6.75; $custom = array('Standard Carrier 7+' => $total); } } elseif ($info['country'] == 'Ireland' || $info['country'] == 'Cyprus' || $info['country'] == 'Gibraltar' || $info['country'] == 'San Marino' || $info['country'] == 'Slovenia' || $info['country'] == 'Switzerland' || $info['country'] == 'Austria' || $info['country'] == 'Belgium' || $info['country'] == 'Denmark' || $info['country'] == 'France' || $info['country'] == 'Germany' || $info['country'] == 'Greece' || $info['country'] == 'Italy' || $info['country'] == 'Luxembourg' || $info['country'] == 'Netherlands' || $info['country'] == 'Portugal' || $info['country'] == 'Spain' || $info['country'] == 'Sweden') { if ($quantity<= '2'){ $custom = array('Standard Carrier 1 to 2' => '5.25'); } if ($quantity >= '3' and $quantity <= 4) { $custom = array('Standard Carrier 3 to 4' => '7.00'); } if ($quantity >= '5' and $quantity <= 6) { $custom = array('Standard Carrier 5 to 6' => '8.50'); } if ($quantity >= 7) { $total = 9.75; $custom = array('Standard Carrier 7+' => $total); } } $this->globals('ecom.customship_response',$custom); ?>
Offline
Hi Dave
Many many thanks for your help
This works as it should now
Also thanks to john for his help earlier...
Ivor
Offline