I'm developing a shipping module that calls make a JSON call to a common service we use internally that generates shipping estimates based on a cart (think Model, Qty and Postcode) and it returns Service Options and Price based on weights and postcode, number of parcels etc.
Everything is working very well, and I was able to make a fairly simple change to the "Flat" rate calculator to get rates coming back through to ZC.
However the returned methods are all showing as bolded, and I'd have thought only the cheapest would have been. Am I missing something simple here, as far as I could see the USPS calculator returns multiple rates so I'm hoping returning multiple services from a shipping module is supported.
Attached pic shows how the results are displaying. I'm using a vanilla install of 155e with this as the only additional module.
Code:
$ShippingResult = json_decode($response,true);
$methods = Array();
foreach ($ShippingResult['options'] as $key => $value) {
$Service = $ShippingResult['options'][$key]['service'];
$Price = Round($ShippingResult['options'][$key]['price'],2);
$methods[] = array('id' => $this->code,
'title' => $Service,
'cost' => $Price);
}
if (sizeof($methods) == 0) { return false; }
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_JSONSERVICE_TEXT_TITLE,
'methods' => $methods);
Bookmarks