问题
I want to Override /sales/order/items/renderer/default.phtml
under Customer Sales Order View Section (My Account Page) from my custom module.
I have created following 3 files.
/app/code/local/Revered/Expdlvrydate/etc/config.xml
<config>
<modules>
<Revered_Expdlvrydate>
<version>0.1.0</version>
</Revered_Expdlvrydate>
</modules>
<frontend>
<layout>
<updates>
<revered>
<file>revered.xml</file>
</revered>
</updates>
</layout>
</frontend>
</config>
/app/design/frontend/base/default/layout/revered/revered.xml
<layout>
<sales_order_view translate="label">
<reference name="my.account.wrapper">
<action method="addItemRender">
<type>default</type>
<block>sales/order_item_renderer_default</block>
<template>revered/sales/order/items/renderer/default.phtml</template>
</action>
<action method="addItemRender">
<type>grouped</type>
<block>sales/order_item_renderer_grouped</block>
<template>revered/sales/order/items/renderer/default.phtml</template>
</action>
</reference>
</sales_order_view>
</layout>
/app/design/frontend/base/default/template/revered/sales/order/items/renderer/default.phtml
I used this file same as default
Thanks in Advance, Ziya
回答1:
Finally I got fixed it myself:
My config file is
/app/code/local/Revered/Expdlvrydate/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Revered_Expdlvrydate>
<version>0.1.0</version>
</Revered_Expdlvrydate>
</modules>
<global>
<frontend>
<layout>
<updates>
<expdlvrydate_layout module="Expdlvrydate">
<file>expdlvrydate.xml</file>
</expdlvrydate_layout>
</updates>
</layout>
</frontend>
</config>
My layout file is
/app/design/frontend/base/default/layout/expdlvrydate.xml
<?xml version="1.0"?>
<layout version="0.1.0">
<sales_order_view>
<reference name="order_items">
<action method="addItemRender">
<type>default</type>
<block>sales/order_item_renderer_default</block>
<template>revered/expdlvrydate/sales/order/items/renderer/default.phtml</template>
</action>
</reference>
</sales_order_view>
</layout>
My phtml file is
/app/design/frontend/base/default/template/revered/sales/order/items/renderer/default.phtml
Added following code below item options
<?php if ($_item = $this->getItem()): ?>
<?php if ( $_item->getEdeliverydate() != NULL):?>
<dl class="item-options">
<dt><?php echo $this->escapeHtml('Expected Delivery Date') ?></dt>
<dd><?php echo $this->formatDate($_item->getEdeliverydate(), 'long'); ?></dd>
</dl>
<?php endif; ?>
<?php endif; ?>
来源:https://stackoverflow.com/questions/59967183/how-to-override-sales-order-items-renderer-default-phtml-under-customer-sales-o