Suppose our Module Name 'CustomSales' and Package Name "Exercise".
Step 1 : Create a module config file into app/etc/modules/Exercise_CustomSales.xml
<config>
<modules>
<Exercise_CustomSales>
<active>true</active>
<codePool>local</codePool>
</Exercise_CustomSales>
</modules>
Step 2: Create a config file under app/code/local/Exercise/CustomSales/etc/config.xml
<config>
<modules>
<Exercise_CustomSales>
<version>1.7.0.2</version>
</Exercise_CustomSales>
</modules>
<global>
<blocks>
<customsales>
<class>Exercise_CustomSales_Block</class>
</customsales>
<sales>
<rewrite>
<order_view>Exercise_CustomSales_Block_Sales_Order_View</order_view>
</rewrite>
</sales>
</blocks>
</global>
Step 3 : Create a php file which is overwrite the actual view.phtml file, app/code/local/Exercise/CustomSales/Block/Sales/Order/View.php
class Exercise_CustomSales_Block_Sales_Order_View extends Mage_Sales_Block_Order_View
{
protected function _construct()
{
parent::_construct();
$this->setTemplate('customsales/sales/order/view.phtml');
}
}
Step 4 : you should create a local.xml file inside layout folder(Possible path: app/design/frontend/package/theme/layout). This is for print.phtml .
e.g (app/design/frontend/rwd/default/layout/local.xml)
<layout>
<sales_order_print>
<reference name="sales.order.print">
<action method="setTemplate">
<template>customsales/sales/order/print.phtml</template>
</action>
</reference>
</sales_order_print>
Move view.phtml and print.phtml file inside "app/design/frontend/package/theme/template/customsales/sales/order".
Clear magento cache.