5

我试图弄清楚如何在管理区域中添加一个新部分以创建新订单。这是我正在对我的自定义扩展进行的更新。扩展效果很好,但我似乎无法弄清楚为什么我不能在创建新订单下添加新部分。

如果您帮我在此部分添加一个块,您将获得 50 点赏金。

这就是我所拥有的。

模块/名称/块/Adminhtml/Sales/Order/Create/test.phtml

<?php

class Module_Name_Block_Adminhtml_Sales_Order_Create_Test extends Mage_Adminhtml_Block_Sales_Order_Create_Abstract
{
    public function __construct()
    {
        $this->_controller = 'adminhtml_sales_order_create_test';
        $this->_blockGroup = 'module_name';
        $this->_headerText = Mage::helper('module_name')->__('Update');
        parent::__construct();
        $this->_removeButton('add');

    }  

    public function getHeaderText()
    {
        return Mage::helper('module_name')->__('Edit');
    }
}

模块/名称/controllers/Adminhtml/Sales/Order/CreateController.php

<?php

    class Module_Name_Adminhtml_Sales_Order_CreateController extends Mage_Adminhtml_Controller_Action
    {
        public function indexAction()
        {
            $this->loadLayout();
            $this->renderLayout();
            return $this;

           // If I echo something here I do see what I echo
        }
    }

模块/名称/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Module_Name>
            <version>0.1.1</version>
        </Module_Name>
    </modules>
    <phpunit>
        <suite>
            <modules>
                <Module_Name/>
            </modules>
        </suite>
    </phpunit>
    <global>   
        <blocks>
            <module_name>
                <class>Module_Name_Block</class>
            </module_name>
        </blocks>
        <helpers>
            <module_name>
                <class>Module_Name_Helper</class>
            </module_name>
        </helpers>
    </global>
    <frontend>
        <routers>
            <module_name>
                <use>standard</use>
                <args>
                    <module>Module_Name</module>
                    <frontName>modulename</frontName>
                </args>
            </module_name>
        </routers>
    </frontend>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <module_name before="Mage_Adminhtml">Module_Name_Adminhtml</module_name>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
    <adminhtml>
        <layout>
            <updates>
                <module_name module="module_name">
                    <file>test.xml</file>
                </module_name>
            </updates>
        </layout>
    </adminhtml>
</config>

app/design/adminhtml/default/default/layout/test.xml

    <?xml version="1.0"?>
    <layout version="0.1.0">

        <adminhtml_sales_order_create_index>
            <reference name="root">
                <block type="module_name/adminhtml_sales_order_create_test" name="test" template="module/name/sales/order/create/test/test.phtml" />
            </reference>
        </adminhtml_sales_order_create_index>

            <adminhtml_sales_order_create_load_block_data>
                <reference name="content">
                   <block type="module_name/adminhtml_sales_order_create_test" name="test" template="module/name/sales/order/create/test/test.phtml" />  
                </reference>
        </adminhtml_sales_order_create_load_block_data>

    </layout>

app/design/adminhtml/default/default/template/module/name/test/test.phtml

<?php

    echo "This is working";

?>
4

1 回答 1

4

尝试从您的布局文件中替换此代码:

<adminhtml_sales_order_create_index>
    <reference name="root">
         <block type="module_name/adminhtml_sales_order_create_test" name="test" template="module/name/sales/order/create/test/test.phtml" />
     </reference>
</adminhtml_sales_order_create_index>

有了这个:

<adminhtml_sales_order_create_index>
    <reference name="order_item_extra_info">
         <block type="module_name/adminhtml_sales_order_create_test" name="test" template="module/name/sales/order/create/test/test.phtml" />
     </reference>
</adminhtml_sales_order_create_index>
于 2013-11-06T10:13:26.267 回答