CompareBasketObject::sortListBy() -> support array

This commit is contained in:
Thomas Gelf 2023-03-07 13:38:40 +01:00
parent 70a822f270
commit df10d6a924

View File

@ -46,7 +46,11 @@ class CompareBasketObject
protected static function sortListBy($key, &$list)
{
usort($list, function ($a, $b) use ($key) {
return $a->$key > $b->$key ? -1 : 1;
if (is_array($a)) {
return $a[$key] > $b[$key] ? -1 : 1;
} else {
return $a->$key > $b->$key ? -1 : 1;
}
});
}