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 11-01-2010 13:25:57

thedevilsgarden
Member
Registered: 09-04-2010
Posts: 6

Shipping help

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

 

#2 11-01-2010 13:57:51

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Shipping help

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.

Code:

<?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

 

#3 11-01-2010 14:06:04

thedevilsgarden
Member
Registered: 09-04-2010
Posts: 6

Re: Shipping help

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

 

#4 11-01-2010 14:13:08

thedevilsgarden
Member
Registered: 09-04-2010
Posts: 6

Re: Shipping help

also meant to say thank you for helping smile

Offline

 

#5 11-01-2010 14:16:23

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Shipping help

In the example I gave any country that isn't in the first if statement

Code:

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

Code:

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

 

#6 11-01-2010 14:22:12

thedevilsgarden
Member
Registered: 09-04-2010
Posts: 6

Re: Shipping help

Cheers John

I will have a play after i have eaten... coding hurts my head

Ivor

Offline

 

#7 11-01-2010 15:27:41

thedevilsgarden
Member
Registered: 09-04-2010
Posts: 6

Re: Shipping help

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

 

#8 11-01-2010 15:39:14

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

Re: Shipping help

You were missing 3 closing braces on if statements.

Code:

<?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

 

#9 11-01-2010 17:27:31

thedevilsgarden
Member
Registered: 09-04-2010
Posts: 6

Re: Shipping help

Hi Dave

Many many thanks for your help

This works as it should now

Also thanks to john for his help earlier...

smile

Ivor

Offline

 

Board footer