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.
Cannot get this shipping script to work.
Can anyone point me in the right direction.
<?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 // | $info = $this->globals('ecom.customship'); $method = 'Standard Shipping'; $shipcountry = $info['country']; $ukcountries = array('UK - Mainland' , 'UK - Highlands & Islands Scotland' , 'UK - Isle of Man' , 'UK - Northern Ireland'); $eucountries = array('Andorra' , 'Austria' , 'Belgium' , 'Bulgaria' , 'Canary Islands' , 'Croatia' , 'Cyprus' , 'Czech Republic' , 'Denmark' , 'Estonia' , 'Faroe Islands' , 'Finland' , 'France' , 'France, Metropolitan' , 'Germany' , 'Gibraltar' , 'Greece' , 'Hungary' , 'Iceland' , 'Ireland' , 'Italy' , 'Latvia' , 'Leichtenstein' , 'Lithuania' , 'Luxembourg' , 'Malta' , 'Monaco' , 'Netherlands' , 'Norway' , 'Poland' , 'Portugal' , 'Romania' , 'San Marino' , 'Slovakia' , 'Slovenia' , 'Spain' , 'Sweden' , 'Switzerland' , 'UK - Channel Islands' , 'Vatican City State'); $nacountries = array('Canada' , 'United States'); if (in_array($shipcountry,$ukcountries)) { // UK shipping $method = 'Shipping - United Kingdom'; if ($info['total'] >= '0' && $info['total'] <= '29.99') { $custom = array($method => '2.00'); } elseif ($info['total'] > '29.99' && $info['total'] <= '59.99') { $custom = array($method => '4.00'); } else { $custom = array($method => '7.00'); } // End of if statement. } elseif (in_array($shipcountry,$eucountries)) { // EU shipping - non UK $method = 'Shipping - Europe'; if ($info['total'] >= '0' && $info['total'] <= '29.99') { $custom = array($method => '4.00'); } elseif ($info['total'] > '29.99' && $info['total'] <= '59.99') { $custom = array($method => '8.00'); } else { $custom = array($method => '16.00'); } // End of if statement. } elseif (in_array($shipcountry,$nacountries)) { // North America shipping $method = 'Shipping - North America'; if ($info['total'] >= '0' && $info['total'] <= '29.99') { $custom = array($method => '5.00'); } elseif ($info['total'] > '29.99' && $info['total'] <= '59.99') { $custom = array($method => '10.00'); } else { $custom = array($method => '25.00'); } // End of if statement. } else { // WORLDWIDE SHIPPING $method = 'Shipping - Worldwide'; if ($info['total'] >= '0' && $info['total'] <= '29.99') { $custom = array($method => '5.00'); } elseif ($info['total'] > '29.99' && $info['total'] <= '59.99') { $custom = array($method => '10.00'); } else { $custom = array($method => '45.00'); } // End of if statement. $custom = array($method => $total); $this->globals('ecom.customship_response',$custom); ?>
Many thanks
Offline
Thanks but it is still not working.
Offline
Yeah that's it, works perfect now.
Many thanks
Offline