I'm given example here of how to extend the sales order view page. Like this, you can extend any module which one you want. Follow the Below Steps
Step 1) Enable the extension to specify the config.php
file from the app/etc folder
<?php
return array (
'modules' =>
array (
'Learning_RewriteSales' => 1,
),
);
Step 2) Create Custom.php
Class in Block
<?php
namespace Learning\RewriteSales\Block\Adminhtml\Order\View;
class Custom extends \Magento\Backend\Block\Template
{
}
Step 3) Create Info.php
file to extend core Info.php
<?php
namespace Learning\RewriteSales\Block\Adminhtml\Order\View;
class Info extends \Magento\Sales\Block\Adminhtml\Order\View\Info
{
}
Step 4) Create di.xml
file to specify which class you were extended ( Dependency Injection )
<?xml version="1.0"?>
<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\View\Info" type="Learning\RewriteSales\Block\Adminhtml\Order\View\Info"/>
</config>
Step 5) Create module.xml
file to specify the setup version
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Learning_RewriteSales" setup_version="2.0.0">
<sequence>
<module name="Magento_Sales"/>
</sequence>
</module>
</config>
Step 6) Create sales_order_view.xml
file from Learning/RewriteSales/view/layout folder and write the below code
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="order_info">
<action method="setTemplate">
<argument name="template" translate="true" xsi:type="string">order/view/info.phtml</argument>
</action>
</referenceBlock>
<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>
Step 7) Create the Custom.phtml
and Info.phtml
file from Learning/RewriteSales/view/layout and insert below code.
Custom.phtml
<h1>Hi, I am here!</h1>
Info.phtml
First Copy the code from Magento\Sales\view\adminhtml\templates\order\view\info.phtml file and past here after that add one more line
<?php echo $block->getChildHtml('sales_order_view_custom');?>
Step 8) Finally clean the cache and see your custom code Sales Order View Page.
It's working for me. If you have any queries let me know?
Sometimes we need to make modifications to existing templates. Instead of making changes directly to existing template files, we should override them in our own theme.
Let us assume that we want to update the category listing page ( list.phtml
). To do so, create following directory structure:
app/design/frontend/Mycompany/Basic/Magento_Catalog/templates/product
Here I assume that our current theme is Basic. Now copy the list.phtml file into product directory from the following location:
app/vendor/magento/module-catalog/view/frontend/templates/product/list.phtml
Now you can make any modifications you want to your overridden file.
For detail please read this tutorial it's help you lot.
Best Answer
1st create ur Admin Theme by using below guide
Magento 2: How to enable newly created admin theme & override module?
or
http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/admin_theme_create.html
Ur file will be here
magento\app\design\adminhtml\YourVendor\YourThemeName\Magento_Backend\view\adminhtml\templates\media\uploader.phtml