// class methods
function quote($method = '') {
global $order,$shipping_weight,$shipping_num_boxes,$db,$currencies;
$total_weight = $shipping_weight * $shipping_num_boxes;
if($total_weight > (int)MODULE_SHIPPING_HK_POST_MAX_WEIGHT){
return false;
}
//package weight
$total_weight += (int)MODULE_SHIPPING_HK_POST_PACKAGE_WEIGHT;
////////////////////
$cost = explode(',',MODULE_SHIPPING_HK_POST_COST);
$first = 13; $continue = 108;
if(count($cost) >= 2){
$first = (int)$cost[0];
$continue = round($cost[1],2);
}else{
$tmp = round($cost[0],2);
if($tmp > 70){
$continue = $tmp;
}
}
////////////////////
$rate = (float)$currencies->currencies['CNY']['value'];
if($rate <= 0){
$rate = 1;
}
$ttl = round(($first+$continue*ceil($total_weight/10)/100)/$rate,2);
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_HK_POST_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_HK_POST_TEXT_WAY,
'cost' => $ttl)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
return $this->quotes;
}