0

I want create a template file for sales->order->create new order.

In layout file(Xxx/Order/view/adminhtml/layout/sales_order_create_index.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>
            <referenceContainer name="billing_method">
                <block class="Magento\Backend\Block\Template" template="Xxx_Order::order/create/billing/method/form.phtml" name="order_create_billing_form" as="form" />
            </referenceContainer>
        </body>
    </page>

This is my core file Sales-module/view/adminhtml/layout/sales_order_create_index.xml

<block class="Magento\Sales\Block\Adminhtml\Order\Create\Billing\Method" template="Magento_Sales::order/create/abstract.phtml" name="billing_method">
                            <block class="Magento\Sales\Block\Adminhtml\Order\Create\Billing\Method\Form" template="Magento_Sales::order/create/billing/method/form.phtml" name="order_create_billing_form" as="form"/>
                        </block>rm" as="form"/>
                        </block>

form.phtml:

<div class="admin__field">
    <label for="history_comment" class="admin__field-label">
        <?= /* @noEscape */ __('Additional Comment') ?>

    </label>

    <div class="admin__field-control">
        <textarea  rows="3"
                   cols="5"
                   id="order-comment"
                   name="order[order_comment]"
                   class="admin__control-textarea"></textarea>
    </div>
</div>

My template file isn't showing after reloading page.

3
  • What is the full file path to sales_order_create_index.xml and additionally to your form.phtml file?
    – Rob
    Commented Feb 8, 2018 at 0:33
  • @Rob updated my post..
    – Mahi M
    Commented Feb 8, 2018 at 3:54
  • Is the site in developer mode? If not, you will need to run php/bin magento static:content:deploy. After this is working modifications should be made in a module as you should never update core files directly.
    – Rob
    Commented Feb 8, 2018 at 12:45

1 Answer 1

0

You need to keep your xml as below way,

<?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="order_create_billing_form">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Xxx_Order::order/create/billing/method/form.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

Clear cache and check.

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.