I was able to do everything until the last step, that is OpenCart shows all the options returned by the external calculator.
The problem is that when the user selects one of the options and clicks on Continue, the following warning appears:
What am I doing wrong?Warning: Shipping method required!
Here is my code:
Code: Select all
$response = file_get_contents($anvil_url, false, $context);
$options = json_decode($response);
$quote_data = array();
$n = 0;
foreach ($options as $option) {
$n += 1;
$quote_data['universe' . $n] = array(
'code' => 'universe.universe',
'title' => $option->title,
'cost' => $option->cost,
'tax_class_id' => 0,
'text' => $this->currency->format($option->cost, $this->session->data['currency'])
);
}
$method_data = array(
'code' => 'universe' . $n,
'title' => $this->language->get('text_title'),
'quote' => $quote_data,
'sort_order' => $this->config->get('shipping_universe_sort_order'),
'error' => false
);