0

I am trying to load my block and template in my custom layout file as per below script but it's not rendering

Core Layout sales_order_create_index.xml :-

<body>
    <referenceContainer name="admin.scope.col.wrap" htmlClass="admin__old" /> <!-- ToDo UI: remove this wrapper with old styles removal. The class name "admin__old" is for tests only, we shouldn't use it in any way -->

    <referenceBlock name="page.title">
        <action method="setTitleId">
            <argument translate="false" name="id" xsi:type="string">order-header</argument>
        </action>
    </referenceBlock>
    <referenceContainer name="after.body.start">
        <block class="Magento\Backend\Block\Template" name="optional_zip_countries" as="optional_zip_countries" template="Magento_Directory::js/optional_zip_countries.phtml"/>
        <block class="Magento\Catalog\Block\Adminhtml\Product\Composite\Configure" name="after.body.start.product_composite_configure" template="Magento_Catalog::catalog/product/composite/configure.phtml"/>
    </referenceContainer>
    <referenceContainer name="js">
        <block class="Magento\Backend\Block\Template" template="Magento_Sales::order/create/js.phtml" name="create"/>
    </referenceContainer>
    <referenceBlock name="content">
        <block class="Magento\Sales\Block\Adminhtml\Order\Create" name="order_content">
            <block class="Magento\Sales\Block\Adminhtml\Order\Create\Form" template="Magento_Sales::order/create/form.phtml" name="order_create_form" as="form">
                <block class="Magento\Sales\Block\Adminhtml\Order\Create\Messages" name="message"/>
                <block class="Magento\Sales\Block\Adminhtml\Order\Create\Customer" template="Magento_Sales::order/create/abstract.phtml" name="customer.grid.container"/>
                <block class="Magento\Sales\Block\Adminhtml\Order\Create\Store" template="Magento_Sales::order/create/abstract.phtml" name="store">
                    <block class="Magento\Sales\Block\Adminhtml\Order\Create\Store\Select" template="Magento_Sales::order/create/store/select.phtml" name="select"/>
                </block>
                <block class="Magento\Sales\Block\Adminhtml\Order\Create\Data" template="Magento_Sales::order/create/data.phtml" name="data">
                    <block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar" template="Magento_Sales::order/create/sidebar.phtml" name="sidebar">
                        <block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Cart" template="Magento_Sales::order/create/sidebar/items.phtml" name="cart"/>
                        <block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Wishlist" template="Magento_Sales::order/create/sidebar/items.phtml" name="wishlist"/>
                        <block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Reorder" template="Magento_Sales::order/create/sidebar/items.phtml" name="reorder"/>
                        <block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Viewed" template="Magento_Sales::order/create/sidebar/items.phtml" name="viewed"/>
                        <block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Compared" template="Magento_Sales::order/create/sidebar/items.phtml" name="compared"/>
                        <block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Pcompared" template="Magento_Sales::order/create/sidebar/items.phtml" name="pcompared"/>
                        <block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Pviewed" template="Magento_Sales::order/create/sidebar/items.phtml" name="pviewed"/>
                    </block>
                    <block class="Magento\Sales\Block\Adminhtml\Order\Create\Form\Account" template="Magento_Sales::order/create/form/account.phtml" name="form_account"/>
                    <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address" template="Magento_Sales::order/create/form/address.phtml" name="shipping_address"/>
                    <block class="Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address" template="Magento_Sales::order/create/form/address.phtml" name="billing_address"/>
                    <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Method" template="Magento_Sales::order/create/abstract.phtml" name="shipping_method">
                        <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Method\Form" template="Magento_Sales::order/create/shipping/method/form.phtml" name="order_create_shipping_form" as="form"/>
                    </block>
                    <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>
                    <block class="Magento\Sales\Block\Adminhtml\Order\Create\Newsletter" template="Magento_Sales::order/create/abstract.phtml" name="newsletter">
                        <block class="Magento\Sales\Block\Adminhtml\Order\Create\Newsletter\Form" template="Magento_Sales::order/create/newsletter/form.phtml" name="order_create_newsletter_form" as="form"/>
                    </block>
                    <block class="Magento\Sales\Block\Adminhtml\Order\Create\Search" template="Magento_Sales::order/create/abstract.phtml" name="search">
                        <block class="Magento\Sales\Block\Adminhtml\Order\Create\Search\Grid" name="search_grid" as="grid"/>
                    </block>
                    <block class="Magento\Sales\Block\Adminhtml\Order\Create\Items" template="Magento_Sales::order/create/items.phtml" name="items">
                        <block class="Magento\Sales\Block\Adminhtml\Order\Create\Items\Grid" template="Magento_Sales::order/create/items/grid.phtml" name="items_grid">
                            <block class="Magento\Sales\Block\Adminhtml\Order\Create\Coupons" template="Magento_Sales::order/create/coupons/form.phtml" name="coupons">
                                <block class="Magento\Sales\Block\Adminhtml\Order\Create\Coupons\Form" template="Magento_Sales::order/create/coupons/form.phtml" name="order_create_coupons_form" as="form"/>
                            </block>
                        </block>
                    </block>
                    <block class="Magento\Sales\Block\Adminhtml\Order\Create\Comment" template="Magento_Sales::order/create/comment.phtml" name="comment"/>
                    <block class="Magento\Sales\Block\Adminhtml\Order\Create\Totals" template="Magento_Sales::order/create/totals.phtml" name="totals"/>
                    <block class="Magento\Backend\Block\Template" name="gift_options" template="Magento_Sales::order/giftoptions.phtml">
                        <block class="Magento\Sales\Block\Adminhtml\Order\Create\Giftmessage" template="Magento_Sales::order/create/giftmessage.phtml" name="giftmessage"/>
                    </block>
                    <block class="Magento\Framework\View\Element\Text\ListText" name="order_item_extra_info"/>
                </block>
            </block>
        </block>
    </referenceBlock>
</body>

My Custom layout sales_order_create_index.xml :-

<body>
    <referenceContainer name="admin.scope.col.wrap">
        <referenceBlock name="content">
            <referenceBlock name="order_content">
                <block class="Vendor\BillingStep\Block\Adminhtml\Customform"  after="data.order_create_billing_form" template="Vendor_BillingStep::order/customform.phtml" name="custom_form"/>
            </referenceBlock>
       </referenceBlock>
    </referenceContainer>
</body>
  • On which place of create order you want to show the form? – Sukumar Gorai Jan 9 at 13:54
0

Try the below code instead of your for the file 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>
        <referenceBlock name="billing_method">
            <block class="Vendor\BillingStep\Block\Adminhtml\Customform"  after="data.order_create_billing_form" template="Vendor_BillingStep::order/customform.phtml" name="custom_form"/>
        </referenceBlock>
    </body>
</page>

Hope this helps!

  • it's not displaying..@sukumar – Ramesh Jan 10 at 5:19
  • Where did you place this xml? – Sukumar Gorai Jan 10 at 5:20
  • I kept that file in Vendor/BillingStep/view/adminhtml/layout – Ramesh Jan 10 at 5:28
  • Can you just add only text like 'Test form' and check its coming or not? It should come just after the payment methods section but only for create order form. – Sukumar Gorai Jan 10 at 5:33
  • we are't able insert in side the "order_content" Block, i directly kept in core file..May i know why? it's not allowing – Ramesh Jan 10 at 6:14

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.