Kryptronic Software Support Forum

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.

#1 07-29-2009 06:50:55

ge01
Member
Registered: 07-29-2009
Posts: 3

Custom shipping method for one state

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.

Code:

$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

 

#2 07-29-2009 07:17:24

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Custom shipping method for one state

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

 

#3 07-29-2009 08:03:14

ge01
Member
Registered: 07-29-2009
Posts: 3

Re: Custom shipping method for one state

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

 

#4 07-30-2009 08:56:50

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Custom shipping method for one state

Untested for your particular situation but no PHP errors:

Code:

$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

 

#5 07-31-2009 04:48:26

ge01
Member
Registered: 07-29-2009
Posts: 3

Re: Custom shipping method for one state

Thanks a lot for your help Dave  smile

Offline

 

Board footer