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.
How could i modify the custom shipping method to calculate where the state is 'London' and cost of goods is over £15, shipping will be
free? I have tried doing something like this below... but I still don't know where i am going wrong, though i believe the main part of the problem lies with the first paragraph of coding that i tries to modify.
$info = $this->globals('ecom.customship');
if ($fd_trackitem_shipcountry ne "UK - England & Wales" &&
$fd_trackitem_shipcountry ne "London") {
$method = 'London Delivery';
$total = '0.00';
$custom = array($method => $total);
$info['total'] > '15.00';
} elseif (($info['country'] == 'UK - England & Wales')||($info['country'] == 'UK - Scotland Mainland')||($info['country'] == 'UK - Highlands & Islands Scotland')||($info['country'] == 'UK - Isle of Man')||($info['country'] == 'UK - Channel Islands')||($info['country'] == 'UK - Northern Ireland')){
// UK shipping
$method = 'UK Delivery';
$total = '3.95';
$custom = array($method => $total);
} elseif (($info['country'] == 'Ireland')||($info['country'] == 'Cyprus')||($info['country'] == 'Finland')||($info['country'] == 'Gibraltar')||($info['country'] == 'Hungary') ||($info['country'] == 'Iceland')||($info['country'] == 'Norway') ||($info['country'] == 'Poland')||($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')){
// European counties charge
$method = 'European Delivery';
$total = '8.99';
$custom = array($method => $total);
} else {
// Rest of the world £6.0
$method = 'World Delivery';
$total = '15.99';
$custom = array($method => $total);
}
$this->globals('ecom.customship_response',$custom);
?>Offline
There is no such test as NE as used in your first test. In PHP not equal is !=. I also don't see you retrieving the order details and in version 6 and 7 of PHP there's no such variable as $fd_trackitiem_shipcountry.
Are you trying to change a CCP 5.1 custom method for use in version 6/7?
Offline
Sorry don't know much about php, just saw the code from a post that was trying to do something similar. I am using version 6, and i just want to change the code so that when the state is 'London' and cost of goods is over £15, shipping will be
free. Thanks
Offline
Untested for your particular situation but no PHP errors:
$info = $this->globals('ecom.customship');
if ($info['stateprov'] == 'London') {
$method = 'London Delivery';
$total = '0.00';
$custom = array($method => $total);
} elseif (($info['country'] == 'UK - England & Wales')||($info['country'] == 'UK - Scotland Mainland')||($info['country'] == 'UK - Highlands & Islands Scotland')||($info['country'] == 'UK - Isle of Man')||($info['country'] == 'UK - Channel Islands')||($info['country'] == 'UK - Northern Ireland')){
// UK shipping
$method = 'UK Delivery';
$total = '3.95';
$custom = array($method => $total);
} elseif (($info['country'] == 'Ireland')||($info['country'] == 'Cyprus')||($info['country'] == 'Finland')||($info['country'] == 'Gibraltar')||($info['country'] == 'Hungary') ||($info['country'] == 'Iceland')||($info['country'] == 'Norway') ||($info['country'] == 'Poland')||($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')){
// European counties charge
$method = 'European Delivery';
$total = '8.99';
$custom = array($method => $total);
} else {
// Rest of the world £6.0
$method = 'World Delivery';
$total = '15.99';
$custom = array($method => $total);
}
$this->globals('ecom.customship_response',$custom);
?>Offline
Thanks a lot for your help Dave ![]()
Offline