Magento add block to sales order create

倖福魔咒の 提交于 2019-12-04 15:48:28

问题


I am trying to add a block to the admin create order screen. Im my layout xml I have

    <adminhtml_sales_order_create_index>
    <reference name="head">
        <action method="addItem"><type>skin_js</type><name>js/fee/fee.js</name></action>
    </reference> 
    <reference name="data">
             <block type="fee/adminhtml_insuranceselector" after="shipping_method" name="fee.insurance" template="fee/sales/order/insuranceselector.phtml" />
    </reference>
</adminhtml_sales_order_create_index>

<adminhtml_sales_order_create_load_block_data>
    <reference name="data">
             <block type="fee/adminhtml_insuranceselector" after="shipping_method" name="fee.insurance" template="fee/sales/order/insuranceselector.phtml" />
    </reference>
</adminhtml_sales_order_create_load_block_data>

The block does not show up at all with reference of "data" or even "content", if I change the reference to say "left" it shows up but I really need it in the data area under the shipping method. The content reference doesn't have a template file so I don't see a need to echo a child block. Not sure what I am doing wrong. Any pointers would be appreciated.


回答1:


The data block does not display all its children anonymously, you can check its template file (app/design/adminhtml/default/default/template/sales/order/create/data.phtml) to see how it's actually working.

To display your own block below the shipping methods, you will need to apply your own template, based on the original, to the data block, and to add a corresponding getChildHtml call where you want it to be displayed.



来源:https://stackoverflow.com/questions/17049033/magento-add-block-to-sales-order-create

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