Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add new table in Magento Create New Order Section

I am trying to figure out how to add a new section in the admin area for creating a new order. This is an update that I am doing to my custom extension. The extension works great but I can't seem to figure out why I cannot add a new section under the create a new order.

If you help me add a block to this section than you will receive a 50 point bounty.

Here is what I have.

Module/Name/Block/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');
    }
}

Module/Name/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
        }
    }

Module/Name/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";

?>
like image 349
Chris78 Avatar asked Oct 03 '22 12:10

Chris78


1 Answers

Try replacing this code from your layout file:

<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>

With this:

<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>
like image 77
Marius Avatar answered Oct 13 '22 12:10

Marius