Using Zen-cart 1.3.9h and Canada Post Shipping Module 1-3-9h lettermail, shipping rates did not work for me.
After reading all of the posts, trying everything suggested, staring at my product dimensions and configuration both in zen-cart and at Canada Post, I finally broke down and decided to debug the code. I had nowhere else to look.
I discovered this in includes/modules/shipping/canadapost.php:
Code:
if ($this->lettermail_available && ($shipping_weight <= $this->lettermail_max_weight))
{
/* Select the correct rate table based on destination country */
switch ($order->delivery['country']['iso_code_2'])
{
case 'CA':
{
$table_cost = preg_split("[:,]", constant('MODULE_SHIPPING_CANADAPOST_LETTERMAIL_CAN'));
$lettermail_service = sprintf("Domestic Lettermail: estimated %d-%d business days", round($this->turnaround_time / 24 + 2), round($this->turnaround_time / 24 + 4)); //factor in turnaround time
break;
}
case 'US':
{
$table_cost = preg_split("[:,]", constant('MODULE_SHIPPING_CANADAPOST_LETTERMAIL_USA'));
$lettermail_service = "U.S.A Letter-post, up to 2 weeks";
break;
}
default:
{
$table_cost = preg_split("[:,]", constant('MODULE_SHIPPING_CANADAPOST_LETTERMAIL_INTL')); //Use overseas rate if not Canada or US
$lettermail_service = "INTL Letter-post, up to 2 weeks";
}
}
I don't think those preg_split calls will work properly unless they look like this:
Code:
if ($this->lettermail_available && ($shipping_weight <= $this->lettermail_max_weight))
{
/* Select the correct rate table based on destination country */
switch ($order->delivery['country']['iso_code_2'])
{
case 'CA':
{
$table_cost = preg_split("/[:,]/", constant('MODULE_SHIPPING_CANADAPOST_LETTERMAIL_CAN'));
$lettermail_service = sprintf("Domestic Lettermail: estimated %d-%d business days", round($this->turnaround_time / 24 + 2), round($this->turnaround_time / 24 + 4)); //factor in turnaround time
break;
}
case 'US':
{
$table_cost = preg_split("/[:,]/", constant('MODULE_SHIPPING_CANADAPOST_LETTERMAIL_USA'));
$lettermail_service = "U.S.A Letter-post, up to 2 weeks";
break;
}
default:
{
$table_cost = preg_split("/[:,]/", constant('MODULE_SHIPPING_CANADAPOST_LETTERMAIL_INTL')); //Use overseas rate if not Canada or US
$lettermail_service = "INTL Letter-post, up to 2 weeks";
}
}
The regular expression "/"s are missing.
Or at least, that's what I had to change to finally get the
lettermail prices to work.