且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Magento 扩展需要覆盖模板

更新时间:2023-11-20 20:36:40

嘿,引用的一个好处是它们通过布局对象的全局空间进行操作,因此您无需进行任何嵌套.感谢您将其工作到布局 xml;好强大!

Heh, one nice thing about references is that they operate through that global space of the layout object, so you needn't do any nesting. Kudos for working this through to layout xml; it's powerful!

我认为您想要做的是替换在销售模块的 LXML 文件中设置的默认项目渲染器(请参阅 sales.xml).这些通过 addItemRender() 方法添加到块类 Mage_Sales_Block_Order_Items(或类组符号中的 sales/order_items),该方法来自 Mage_Sales_Block_Items_Abstract.您需要替换存储在 _itemRenderers 数组的 default 键中的渲染器,您只需执行以下操作即可:

What you want to do, I think, is replace the default item renderer which is being set in the sales module's LXML file (see sales.xml). These are added to the block class Mage_Sales_Block_Order_Items (or sales/order_items in class group notation) via the addItemRender() method, which comes from Mage_Sales_Block_Items_Abstract. You need to replace the renderer stored in the default key of the _itemRenderers array, and you can do that simply by doing the following:

<sales_order_view>
    <reference name="order_items">
        <action method="addItemRender">
            <arg1>default</arg1>
            <arg2>groupname_extensionname/sales/order/items/renderer/default.phtml</arg2>
        </action>
    </reference>
</sales_order_view>

如果这不起作用,请告诉我,因为它不应该超出此范围.

Let me know if this doesn't do the trick, because it shouldn't take much more beyond this.