3

I have creat a custom module that adds a custom field to checkout. It is the input text field. I save this value to quote table and to the sales_order table. But now I want to display this value in admin panel Sales->Order, under Shipping Method information. How can I do this?

Thanks in advance for all the tips.

1
  • how did you saved values in database
    – imtiazau
    Commented Nov 11, 2019 at 14:03

1 Answer 1

1

you can achieve this by adding your template file to sales_order_view.xml ,

<?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>      
        <referenceBlock name="order_info">
            <block class="Learning\RewriteSales\Block\Adminhtml\Order\View\Custom" name="sales_order_view_custom" template="order/view/custom.phtml" />
        </referenceBlock>
    </body>
</page>

and in your template file you can get the relevant information . for this you have to create 1.one block 'Learning\RewriteSales\Block\Adminhtml\Order\View\Custom' 2.one template 'order/view/custom.phtml' 3.and the changes to sales_order_view.xml as mentioned above ,

for more information you can refer this link enter link description here

if you face any problem , let me know , i will help :)

4
  • Thank you for your answer. It works perfect. But i have one more question. How can i display this block in Payment & Shipping Method under Shipping Informations?
    – SebastianT
    Commented Jul 15, 2019 at 12:05
  • @SebastianT , for that you would need to edit the overwrite the template vendor/magento/module-shipping/view/adminhtml/templates/order/view/info.phtml Commented Jul 16, 2019 at 12:08
  • @SebastianT , here you will find div with the class 'admin__page-section-item-content' after that div you can call your static block or your phtml file , if you need help with that , this will help you magento.stackexchange.com/questions/212207/… , let me know how it goes Commented Jul 16, 2019 at 12:15
  • Thank you, your answers were very helpful, i did what i wanted. :)
    – SebastianT
    Commented Jul 24, 2019 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.