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.

  • how did you saved values in database – imtiazau Nov 11 at 14:03
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 :)

  • 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 Jul 15 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 – Kumar Jul 16 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 – Kumar Jul 16 at 12:15
  • Thank you, your answers were very helpful, i did what i wanted. :) – SebastianT Jul 24 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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