From 3b0e21dc5b88cf053b0cae7a83367617c5761db9 Mon Sep 17 00:00:00 2001 From: Michiel Gerritsen Date: Tue, 31 Aug 2021 09:05:11 +0200 Subject: [PATCH] Feature: Sort issuers by name --- app/code/community/Mollie/Mpm/Block/Payment/Form.php | 12 ++++++++++++ .../default/template/mollie/mpm/payment/form.phtml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/code/community/Mollie/Mpm/Block/Payment/Form.php b/app/code/community/Mollie/Mpm/Block/Payment/Form.php index 97f8eacd..73edc8f2 100644 --- a/app/code/community/Mollie/Mpm/Block/Payment/Form.php +++ b/app/code/community/Mollie/Mpm/Block/Payment/Form.php @@ -113,4 +113,16 @@ public function getIssuerTitle($code) return $this->__('Select Issuer'); } + /** + * @param \Mollie\Api\Resources\IssuerCollection $issuers + */ + public function sortIssuers($issuers) + { + $issuers->uasort(function($a, $b) { + return strcmp(strtolower($a->name), strtolower($b->name)); + }); + + return $issuers; + } + } diff --git a/app/design/frontend/base/default/template/mollie/mpm/payment/form.phtml b/app/design/frontend/base/default/template/mollie/mpm/payment/form.phtml index 4007482f..a8a7faa7 100644 --- a/app/design/frontend/base/default/template/mollie/mpm/payment/form.phtml +++ b/app/design/frontend/base/default/template/mollie/mpm/payment/form.phtml @@ -52,7 +52,7 @@ $method = $this->getMethodByCode($code);