I have a list of addresses for a shipping module. Once selected they should be saved using (POST)
as a text comment $option
. This used to work but after rewriting some of the function POST
doesn't work. What is wrong here?
public function options($items, $subtotal, $tax, $currency_code, $customer) {
$vars = explode(';', $this->settings['addresses']);
$options = '';
foreach ($vars as $row)
{
$options .= '<option value="' . $row . '" >' . $row . '</option>' . PHP_EOL;
}
$fileds = '<select name="address" class="form-control">' . PHP_EOL . $options . '</select>';
return array(
'title' => $this->name,
'options' => array(
array(
'id' => 'option_1',
'icon' => $this->settings['icon'],
'name' => 'option 1',
'description' => '',
'fields' => $fileds,
'cost' => $this->settings['fee'],
),
),
);
}
public function after_process($order)
{
$option = $_POST['address'];
$order->data['comments'][] = array(
'text' => $this->name . ': ' . $option,
);
$order->save();
}
EDIT: to be clear, I cant post data from <select><option>
Comments
Post a Comment