Skip to content

How i can display all available payment methods in multi select dropdown on customer edit page Admin?

I want to display all payment methods in multi select field on customer edit page (Admin From).

How it is possibe ?

Darshit/ShipByCustomer/view/adminhtml/layout/customer_index_edit.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="customer_form">
            <block class="DarshitShipByCustomerBlockAdminhtmlCustomerEditTabView" name="disable_payment_method">
                <arguments>
                    <argument name="sort_order" xsi:type="number">100</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>

Darshit/ShipByCustomer/Block/Adminhtml/CustomerEdit/Tab/View.php

<?php

namespace DarshitShipByCustomerBlockAdminhtmlCustomerEditTab;

use MagentoBackendBlockTemplate;
use MagentoBackendBlockTemplateContext;
use MagentoFrameworkRegistry;
use MagentoUiComponentLayoutTabsTabInterface;

class View extends Template implements TabInterface
{
protected $_template = 'tab/paymentMethods.phtml';

public function __construct(
    Context $context,
    Registry $registry,
    array $data = []
) {
    $this->_coreRegistry = $registry;
    parent::__construct($context, $data);
}

public function getCustomerId()
{
    return $this->_coreRegistry->registry(MagentoCustomerControllerRegistryConstants::CURRENT_CUSTOMER_ID);
}

public function getTabLabel()
{
    return __('Custom Tab');
}

public function getTabTitle()
{
    return __('Custom Tab');
}

public function canShowTab()
{
    if ($this->getCustomerId()) {
        return true;
    }
    return false;
}

public function isHidden()
{
    if ($this->getCustomerId()) {
        return false;
    }
    return true;
}

public function getTabClass()
{
    return '';
}

public function getTabUrl()
{
    return '';
}

public function isAjaxLoaded()
{
    return false;
}
}

Darshit/ShipByCustomer/view/adminhtml/templates/tab/paymentMethods.phtml

<h1>Hello</h1>