76 lines
2.6 KiB
PHP
76 lines
2.6 KiB
PHP
<?php
|
|
/*
|
|
+--------------------------------------------------------------------------
|
|
| CubeCart 4
|
|
| ========================================
|
|
| CubeCart is a registered trade mark of Devellion Limited
|
|
| Copyright Devellion Limited 2006. All rights reserved.
|
|
| Devellion Limited,
|
|
| 5 Bridge Street,
|
|
| Bishops Stortford,
|
|
| HERTFORDSHIRE.
|
|
| CM23 2JU
|
|
| UNITED KINGDOM
|
|
| http://www.devellion.com
|
|
| UK Private Limited Company No. 5323904
|
|
| ========================================
|
|
| Web: http://www.cubecart.com
|
|
| Date: Friday, 15 July 2007
|
|
| Email: info@cubecart.com
|
|
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
|
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
|
+--------------------------------------------------------------------------
|
|
| calc.php
|
|
| ========================================
|
|
| Canada Post Module
|
|
+--------------------------------------------------------------------------
|
|
*/
|
|
// Canada Post
|
|
|
|
require_once 'classes'.CC_DS.'canadapost.class.php';
|
|
if (!function_exists('xmlize')) require_once 'classes'.CC_DS.'xmlize.inc.php';
|
|
|
|
function Canada_Post() {
|
|
global $lang, $subTotal, $totalWeight, $basket; // $basket is the basket array
|
|
|
|
$moduleName = "Canada_Post";
|
|
$module = fetchDbConfig($moduleName);
|
|
$taxVal = taxRate($module['tax']);
|
|
|
|
if ($module['status'] == true) {
|
|
$postageArray = array(
|
|
'subTotal' => $subTotal,
|
|
'totalWeight'=> $totalWeight,
|
|
'basket' => array(
|
|
'city' => $basket['delInf']['town'],
|
|
'state' => $basket['delInf']['county'],
|
|
'postcode' => $basket['delInf']['postcode'],
|
|
'country' => getCountryFormat($basket['delInf']['country']),
|
|
),
|
|
);
|
|
$cpost = new Canada_Post($module, $postageArray);
|
|
|
|
$i = 0;
|
|
if (is_array($cpost->request())) {
|
|
|
|
foreach ($cpost->request() as $method) {
|
|
|
|
$method['price'] = $method['price'] + $method['handling'];
|
|
|
|
$out[$i]['value'] = $method['price']; # Shipping value out e.g. 4.34
|
|
$out[$i]['desc'] = priceFormat($method['price'], true)." ".$method['name']; # Formatted price to show on cart page
|
|
$out[$i]['method'] = "Canada Post (".$method['name'].") ".priceFormat($module['level'], true); // Description of shipping method e.g. Canada Post (Air Mail) $3.25
|
|
## depending on how the store is configured tax can either be calculated now or later with the id taxRate() will bring back a value based on ID
|
|
$out[$i]['taxId'] = $module['tax']; // Tax ID number used by cart.inc.php to work out tax on shipping later
|
|
$out[$i]['taxAmount']= $taxVal; // Tax amount as an amount
|
|
$i++;
|
|
}
|
|
return $out;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
$shipArray[] = Canada_Post();
|
|
|
|
?>
|