3

I think I may have stumbled across a core defect, but not 100% sure.

Exhibit A:

<!-- adminhtml/default/default/layout/sales.xml -->
<block type="adminhtml/sales_order_create_data" template="sales/order/create/data.phtml" name="data">
    ...
    <block type="core/text_list" name="order_item_extra_info"></block>
</block>

Exhibit B:

<!-- adminhtml/default/default/template/sales/order/create/data.phtml -->
No reference to order_item_extra_info to be found

What I'm trying to do in my particular case is to inject a template into this text list in order to inject some javascript that will run after the shipping address loads in the backend order creation routine.

So I've simply added <?php echo $this->getChildHtml('order_item_extra_info') ?> to data.phtml but wanted to make sure this was a core fix and not a core hack.

1

I’ve been working on this issue for the last couple of weeks to no real avail. Magento support hasn’t proved to be much use as they are

“not able to fix this issue as it is more of an enhancement request, since there is no such definition in our native layouts for exactly that template”.

Simply adding <?php echo $this->getChildHtml('order_item_extra_info') ?> to the bottom of adminhtml/default/default/template/sales/order/create/data.phtml does in fact allow you to render custom forms at the bottom of the Order Creation page within the admin panel.

Here’s an example where I injected a simple “Hello World”.

hello world working

However, for some reason this also breaks the "Re-order" functionality and the template is rendered in an odd place on that page, right where you should be adding products instead.

hello world in wrong place

This looks a bit silly with "Hello World" popping up in the wrong place, but were I to replace this with a fully fledged form it would look mad and break a lot of functionality.

Seeing as this form is clearly not working (even with a core hack) I think the best approach is to create a new tab on the Order View page within the admin panel, and add your custom form element within there.

Your layout xml should look a bit like this:

<adminhtml_sales_order_view>
    <reference name="sales_order_tabs">
        <action method="addTab">
            <name>your_name.goes_here</name>
            <block>namespace_module/adminhtml_sales_order_whatever_tab</block>
        </action>
    </reference>
</adminhtml_sales_order_view>

Then all you have to do is create a block (which I think defines it's template with a $this->setTemplate in the constructor) which implements Mage_Adminhtml_Block_Widget_Tab_Interface and extends Mage_Adminhtml_Block_Widget

At least with this method you can be a lot happier that you are not breaking vanilla functionality, and you are still able to add extra data to an admin panel order.

0

Sounds like this is, in fact, a core bug.

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.