4

I need to rewrite the code for sales/order item view in Admin which is located in here:

app/design/adminhtml/default/default/template/sales/items/column/name.phtml

i need to completely rewrite the phtml code, is there a way to this?

what i've done so far:

phtml location:

app/design/adminhtml/default/default/template/namespace/module/name.phtml

layout location:

app/design/adminhtml/default/default/layout/namespace/module/module.xml

layout code:

<?xml version="1.0" ?>
<layout>
  <adminhtml_sales_order_view>
      <reference name="order_items">
          <action method="addColumnRender">
              <column>name</column>
              <block>adminhtml/sales_items_column_name</block>
              <template>namespace/module/name.phtml</template>
          </action>
          <action method="addColumnRender">
              <column>name</column>
              <block>adminhtml/sales_items_column_name_grouped</block>
              <template>namespace/module/name.phtml</template>
              <type>grouped</type>
          </action>
      </reference>
  </adminhtml_sales_order_view>
</layout>
1

You can rewrite app/design/adminhtml/default/default/template/sales/items/column/name.phtml file by below code.

<adminhtml_sales_order_view>
    <reference name="order_items">
        <action method="addColumnRender">
            <column>name</column>
            <block>adminhtml/sales_items_column_name</block>
            <template>PATH_TO_YOUR_PHTML_FILE</template>
        </action>
        <action method="addColumnRender">
            <column>name</column>
            <block>adminhtml/sales_items_column_name_grouped</block>
            <template>PATH_TO_YOUR_PHTML_FILE</template>
            <type>grouped</type>
        </action>
    </reference>
</adminhtml_sales_order_view>

Add above code to your layout xml file.

  • where should i put my phtml file? in extension or custom theme? can you explain it by detail step by step? – simple guy May 22 '17 at 5:05
  • If you have a module ready then create your template file in app/design/adminhtml/default/default/template/yourmodulename/name.phtml and put this path to PATH_TO_YOUR_PHTML_FILE in xml file. Refer to sohel's comment for more reference. – Jaimin Sutariya May 22 '17 at 5:13
  • its not working, see my updated question – simple guy May 22 '17 at 6:07
  • @simpleguy, Please add your config.xml code to the question. – Jaimin Sutariya May 22 '17 at 6:08
  • oh yeah i forgot to add to config.xml , now it's working thanks – simple guy May 22 '17 at 6:13

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.