I have a requirement of a client to add an employee pin prior to processing a credit card payment via the admin order screen.
Validating the pin isn't an issue but I am having a hard time figuring out how to utilize my custom form instead of the default magento cc-form with the Magento 2 xml and template system on the admin side.
Any assistance or example that overrides the standard cc-form in the administration order section would be greatly appreciated.
In Magento 1.x I would set a custom form template for the admin via:
class Packagename_Modulename_Block_Form_Customform extends Mage_Payment_Block_Form
{
protected function _construct()
{
parent::_construct();
$this->setTemplate('somefolder/form/customform.phtml');
}
}
Best Answer
To me I think you should use the
setMethodFormTemplate
from\Magento\Payment\Block\Form\Container.php
:So I reckon you can create the following layout file in your module:
Vendor\Module\view\adminhtml\layout\sales_order_create_index.xml
:Also create another layout file:
Vendor\Module\view\adminhtml\layout\sales_order_create_load_block_billing_method.xml
Then you can create your custom template under
Vendor\Module\view\adminhtml\templates\cc\form.phtml
.Also you may need to add the following to your module XML: