mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-01 19:03:14 +03:00
Sorting CRM statuses using 'ordering'
This commit is contained in:
parent
4fb5030c23
commit
df8f030c84
@ -286,13 +286,22 @@ class RetailcrmReferences
|
||||
$crmStatusTypes[] = array(
|
||||
'id_option' => '',
|
||||
'name' => '',
|
||||
'ordering' => '',
|
||||
);
|
||||
foreach ($request->statuses as $sType) {
|
||||
$crmStatusTypes[] = array(
|
||||
'id_option' => $sType['code'],
|
||||
'name' => $sType['name']
|
||||
'name' => $sType['name'],
|
||||
'ordering' => $sType['ordering'],
|
||||
);
|
||||
}
|
||||
usort($crmStatusTypes, function ($a, $b) {
|
||||
if ($a['ordering'] == $b['ordering']) {
|
||||
return 0;
|
||||
} else {
|
||||
return ($a['ordering'] < $b['ordering'] ? -1 : 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return $crmStatusTypes;
|
||||
|
Loading…
x
Reference in New Issue
Block a user