From 33d742341c577575b4033fe46fbe5c22da321dcd Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 28 Feb 2024 17:12:50 +0530 Subject: [PATCH] Add Order Currency filter --- controllers/admin/AdminOrdersController.php | 33 +++++++++++++++------ 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 92ac3c55d..d7eb9114d 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -122,6 +122,11 @@ class AdminOrdersControllerCore extends AdminController $this->roomsArray[$hotelRoom['id']] = $hotelRoom['room_num'].', '.$hotelRoom['room_type_name'].', '.$hotelRoom['hotel_name']; } + $orderCurrencies = Db::getInstance()->executeS('SELECT DISTINCT(`id_currency`) FROM `'._DB_PREFIX_.'orders`'); + foreach ($orderCurrencies as $orderCurrency) { + $this->orderCurrenciesArray[$orderCurrency['id_currency']] = Currency::getCurrencyInstance($orderCurrency['id_currency'])->name; + } + $this->fields_list = array( 'id_order' => array( 'title' => $this->l('ID'), @@ -215,15 +220,6 @@ class AdminOrdersControllerCore extends AdminController } $this->fields_list = array_merge($this->fields_list, array( - 'total_paid_tax_incl' => array( - 'title' => $this->l('Order Total'), - 'align' => 'text-right', - 'type' => 'range', - 'validation' => 'isFloat', - 'currency' => true, - 'callback' => 'setOrderCurrency', - 'badge_success' => true, - ), 'amount_due' => array( 'title' => $this->l('Due Amount'), 'align' => 'text-right', @@ -236,6 +232,25 @@ class AdminOrdersControllerCore extends AdminController 'optional' => true, 'visible_default' => true ), + 'id_currency' => array( + 'title' => $this->l('Order Currency'), + 'align' => 'text-center', + 'type' => 'select', + 'multiple' => true, + 'operator' => 'or', + 'filter_key' => 'a!id_currency', + 'list' => $this->orderCurrenciesArray, + 'displayed' => false, + ), + 'total_paid_tax_incl' => array( + 'title' => $this->l('Order Total'), + 'align' => 'text-right', + 'type' => 'range', + 'validation' => 'isFloat', + 'currency' => true, + 'callback' => 'setOrderCurrency', + 'badge_success' => true, + ), 'payment' => array( 'title' => $this->l('Payment') ),