mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-03 11:43:16 +03:00
Sorting CRM statuses using 'ordering'
This commit is contained in:
parent
4fb5030c23
commit
df8f030c84
@ -286,13 +286,22 @@ class RetailcrmReferences
|
|||||||
$crmStatusTypes[] = array(
|
$crmStatusTypes[] = array(
|
||||||
'id_option' => '',
|
'id_option' => '',
|
||||||
'name' => '',
|
'name' => '',
|
||||||
|
'ordering' => '',
|
||||||
);
|
);
|
||||||
foreach ($request->statuses as $sType) {
|
foreach ($request->statuses as $sType) {
|
||||||
$crmStatusTypes[] = array(
|
$crmStatusTypes[] = array(
|
||||||
'id_option' => $sType['code'],
|
'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;
|
return $crmStatusTypes;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user