0

I am trying to override the create new order page so that append comments is not selected by default.

This is the file I need to overwrite,

vendor/magento/module-sales/view/adminhtml/templates/order/create/totals.phtml

My custom extension located at,

app/code/vendor/modulename

registration.php

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'vendor_modulename',
__DIR__
);

etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<preference for="Magento\Sales\Block\Adminhtml\Order\Create" type="vendor\modulename\Block\Adminhtml\Order\Create" />
</config>

etc/module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="vendor_modulename" setup_version="1.0.0">
        <sequence>
            <module name="Magento_Sales"/>
        </sequence>
    </module>
</config>

view/adminhtml/layout/sales_order_view.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="order_totals">
            <action method="setTemplate">
                <argument name="template" translate="true" xsi:type="string">vendor_modulename::order/create/totals.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

view/adminhtml/templates/order/create/totals.phtml

My changes are not applying in create new order, any help would be appreciated.

Your Answer

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

Browse other questions tagged or ask your own question.