Trabla: PrestaShop: Order Statuses for select html element
Solving:
$this->context = Context::getContext();
$statuses = OrderState::getOrderStates((int)$this->context->language->id);
$statuses_list = array(
array(
'value' => 0,
'name' => ' - '
)
);
foreach ($statuses as $status)
{
array_push($statuses_list, array(
'value' => $status['id_order_state'],
'name' => $status['name'] . ' (ID='.$status['id_order_state'].')'
));
}
// ... use $statuses_list as list for select
$this->fields_options = array(
'general' => array(
'title' => $this->l('My Admin Settings'),
'icon' => 'icon-cogs',
'fields' => array(
'DO_WHEN_ORDER_STATUS' => array(
'title' => $this->l('Do When Order Status'),
'hint' => $this->l('Do When Order Status '),
'type' => 'select',
'list' => $statuses_list,
'identifier' => 'value',
'validation' => 'isInt',
'cast' => 'intval'
),
),
'submit' => array('title' => $this->l('Save'))
),
);
No comments:
Post a Comment