Totally Zenned
- Join Date:
- Jun 2005
- Location:
- Kelowna, BC Canada
- Posts:
- 1,033
- Plugin Contributions:
- 4
How to get custom shipping module costs through to checkout?
The wiki seems to be vacant on this issue from what I can find, but if there is a guide... please provide a link.
I'm trying to make a custom shipping module. I started with various built in one but couldn't figure out how to get multiple shipping options. Then I emulated some of the add-on modules that have that (DHL, UPS) and managed to get multiple options to show... but choosing an option and clicking continue results in a shipping cost of zero, even though they were displayed correctly in the shipping page.
What's the trick?
Here's an example quote function.
function quote($method = '') {
global $order, $shipping_weight, $shipping_num_boxes, $total_weight, $boxcount, $handling_cp, $cart;
$methods = array();
for ($x = 0; $x <= 10; $x++) {
$methods[] = array('id' => 'ID' . $x,
'title' => 'Title' . $x,
'cost' => $x,
'insurance' => $x*.1,
);
}
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_SFC_TEXT_TITLE,
'methods' => $methods);
if ($this->tax_class > 0) {
$this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
return $this->quotes;
}
It works and I'm shown 10 options priced $1 to $10... but choosing any shows zero next page.
Thanks.