How to Override /sales/order/items/renderer/default.phtml under Customer Sales Order View Section in magento 1.9?

你说的曾经没有我的故事 提交于 2020-02-07 02:01:09

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!