Hello,
How can I add a new input field on order view page - something similar to the 'comments section'.
Purpose I need it is to save some code reference into it for some orders.
I need it for admin only, so this is NOT a checkout field, and I ant to be able to show it under sales grid columns as well, and further edit from sale view page.
Any idea appreciated!
Thanks
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <!--add custom block --> <referenceBlock name="order_additional_info"> <block class="Vendor\Module\Block\Adminhtml\Order\View\View" name="custom_view" template="order/view/view.phtml"/> </referenceBlock> </body> </page>
<?php namespace Vendor\Module\Block\Adminhtml\Order\View\; class View extends \Magento\Backend\Block\Template { public function myFunction() { //your code return "Customers' Instruction"; } }Add the below code in
<div> <h1><?php echo $block->myFunction()?></h1> <h3>Thank you.</h3> </div>
Well, what I find most difficult is that i need it to be an editable field which should be saved from the order view page. Displaying it inside a block wherever it's not the biggest challenge.