1

i am trying to add the custom block after the sale order grid.i tried below xml code but could not succeeded.

<adminhtml_sales_order_grid>
    <reference name="sales_order.grid">
        <block type="core/template" name="testing" before="-" template="test/test.phtml"></block> 
    </reference>
</adminhtml_sales_order_grid>

2 Answers 2

3

Try this :

<adminhtml_sales_order_index>
   <reference name="content">
      <block type="core/template" name="testing" before="-" template="test/test.phtml"></block> 
   </reference>
</adminhtml_sales_order_index>
1

1 Create a module config file into app/etc/modules/Stackoverflow_CustomSales.xml

<config>
    <modules>
        <Stackoverflow_CustomSales>
            <active>true</active>
            <codePool>local</codePool>
        </Stackoverflow_CustomSales>
    </modules>
</config>

2 Create a config file under app/code/local/Stackoverflow/CustomSales/etc/config.xml

  <config>
        <modules>
            <Stackoverflow_CustomSales>
                <version>1.7.0.2</version>
            </Stackoverflow_CustomSales>
        </modules>
        <adminhtml>
            <layout>
                <updates>
                    <customsales>
                        <file>stackoverflow_customsales.xml</file>
                    </customsales>
                </updates>
            </layout>
        </adminhtml>
        <global>
            <blocks>
                <customsales>
                    <class>Stackoverflow_CustomSales_Block</class>
                </customsales>
            </blocks>
        </global>
    </config>

3 Create a block app/code/local/Exercise/CustomSales/Block/Sales/Order/View/Custom.php

class Stackoverflow_CustomSales_Block_Sales_Order_View_Custom extends Mage_Core_Block_Template
{

}

4 Create a layout config file app/design/adminhtml/default/default/layout/exercise_customsales.xml

<layout version="0.1.0">
    <adminhtml_sales_order_view>
        <reference name="order_items">
            <action method="setTemplate"><template>customsales/sales/order/view/items.phtml</template></action>
            <block type="customsales/sales_order_view_custom" name="customsales_sales_order_view_custom" template="customsales/sales/order/view/custom.phtml"/>
        </reference>
    </adminhtml_sales_order_view>
</layout>

4 Copy sales/order/view/items.phtml into customsales/sales/order/view/items.phtml Open this file and add one line code, look like,

<div class="grid np">
......
......
</div>
<br />
<?php echo $this->getChildHtml('customsales_sales_order_view_custom');?>

5 Create a new file customsales/sales/order/view/custom.phtml, you can add your custom content. Clear cache and go to order view page.

1
  • i want to add with sale_order_grid not with sale_order_view May 6, 2015 at 11:53

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.