Skip to content

Commit 28c86be

Browse files
author
Nikita Chubukov
committed
MAGETWO-96432: Payment method title does not update in the admin sales order grid
- Change title definition logic for offline payment methods
1 parent 62c5acc commit 28c86be

File tree

2 files changed

+9
-38
lines changed

2 files changed

+9
-38
lines changed

app/code/Magento/Payment/Helper/Data.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,13 @@ public function getPaymentMethodList($sorted = true, $asLabelValue = false, $wit
261261
$groupRelations = [];
262262

263263
foreach ($this->getPaymentMethods() as $code => $data) {
264-
if (isset($data['title'])) {
265-
$methods[$code] = $data['title'];
266-
} else {
267-
$methods[$code] = $this->getMethodInstance($code)->getConfigData('title', $store);
264+
if (!empty($data['active'])) {
265+
$storedTitle = $this->getMethodInstance($code)->getConfigData('title', $store);
266+
if (isset($storedTitle)) {
267+
$methods[$code] = $storedTitle;
268+
} elseif (isset($data['title'])) {
269+
$methods[$code] = $data['title'];
270+
}
268271
}
269272
if ($asLabelValue && $withGroups && isset($data['group'])) {
270273
$groupRelations[$code] = $data['group'];

app/code/Magento/Payment/Ui/Component/Listing/Column/Method/Options.php

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
*/
66
namespace Magento\Payment\Ui\Component\Listing\Column\Method;
77

8-
use Magento\Payment\Api\PaymentMethodListInterface;
9-
use Magento\Store\Model\StoreManagerInterface;
10-
118
/**
129
* Class Options
1310
*/
@@ -23,29 +20,15 @@ class Options implements \Magento\Framework\Data\OptionSourceInterface
2320
*/
2421
protected $paymentHelper;
2522

26-
/**
27-
* @var PaymentMethodListInterface
28-
*/
29-
private $paymentMethodList;
30-
31-
/**
32-
* @var StoreManagerInterface
33-
*/
34-
private $storeManager;
35-
3623
/**
3724
* Constructor
3825
*
3926
* @param \Magento\Payment\Helper\Data $paymentHelper
4027
*/
4128
public function __construct(
42-
\Magento\Payment\Helper\Data $paymentHelper,
43-
\Magento\Payment\Api\PaymentMethodListInterface $paymentMethodList,
44-
\Magento\Store\Model\StoreManagerInterface $storeManager
29+
\Magento\Payment\Helper\Data $paymentHelper
4530
) {
4631
$this->paymentHelper = $paymentHelper;
47-
$this->paymentMethodList = $paymentMethodList;
48-
$this->storeManager = $storeManager;
4932
}
5033

5134
/**
@@ -56,23 +39,8 @@ public function __construct(
5639
public function toOptionArray()
5740
{
5841
if ($this->options === null) {
59-
$this->options = $this->getPaymentOptions();
60-
// $this->options = $this->paymentHelper->getPaymentMethodList(true, true);
42+
$this->options = $this->paymentHelper->getPaymentMethodList(true, true);
6143
}
6244
return $this->options;
6345
}
64-
65-
/**
66-
* @return array
67-
* @throws \Magento\Framework\Exception\NoSuchEntityException
68-
*/
69-
private function getPaymentOptions()
70-
{
71-
$options = [];
72-
foreach ($this->paymentMethodList->getList($this->storeManager->getStore()->getId()) as $option) {
73-
$options[$option->getCode()] = ['value' => $option->getCode(), 'label' => $option->getTitle()];
74-
}
75-
asort($options);
76-
return $options;
77-
}
7846
}

0 commit comments

Comments
 (0)