0

I want to add tabs and fields. But somehow it does not display anything, just the header and footer of the magento admin. What should I do ? Thx This is the structure of my module :

enter image description here

This is the content of etc/adminhtml.xml:

   <?xml version="1.0"?>
<config>
    <menu>
        <attributegrouping translate="title" module="attributegrouping">
            <title>Attribute Grouping</title>
            <sort_order>90</sort_order> 
            <children>
                <form translate="title" module="attributegrouping">
                    <title>Add new group</title>
                    <sort_order>10</sort_order>
                    <action>adminhtml/addgroup/index/</action>
                </form>
            </children>
        </attributegrouping>
    </menu>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <netgroup>
                        <title>Netgroup</title>
                        <sort_order>90</sort_order>
                        <children>
                            <form>
                                <title>Add new group</title>
                                <sort_order>10</sort_order>
                            </form>
                        </children>
                    </netgroup>
                </children>
            </admin>
        </resources>
    </acl>
</config>

This is the content of etc/config.xml :

<?xml version="1.0"?>
<config>
    <modules>
        <Netgroup_Attributegrouping>
            <version>1.0.0</version>
        </Netgroup_Attributegrouping>
    </modules>

    <global>
        <blocks>
            <attributegrouping>
                <class>Netgroup_Attributegrouping_Block</class>
            </attributegrouping>
        </blocks>

        <helpers>
            <attributegrouping>
                <class>Netgroup_Attributegrouping_Helper</class>
            </attributegrouping>
        </helpers>
    </global>

    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <netgroup_attributegrouping after="Mage_Adminhtml">Netgroup_Attributegrouping_Adminhtml</netgroup_attributegrouping>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>

    <adminhtml>
        <layout>
            <updates>
                <netgroup_attributegrouping>
                    <file>netgroup_attributegrouping.xml</file>
                </netgroup_attributegrouping>
            </updates>
        </layout>
    </adminhtml>
</config>

This is the controllers/Adminhtml/AddgroupController.php content:

<?php

class Netgroup_Attributegrouping_Adminhtml_AddgroupController extends 

Mage_Adminhtml_Controller_Action
{
        public function indexAction() 
        {
                $this->loadLayout();
                $this->renderLayout();
        }

}

This is the content of Block/Adminhtml/Form/Edit/Tabs.php:

<?php

class Netgroup_Attributegrouping_Block_Adminhtml_Form_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
{

    public function __construct()
    {
        parent::__construct();
        $this->setId('edit_home_tabs');
        $this->setDestElementId('edit_form');
        $this->setTitle(Mage::helper('netgroup_attributegrouping')->__('Form Tabs'));
    }
    protected function _beforeToHtml()
    {
        $this->addTab('general', array(
            'label'     => Mage::helper('netgroup_attributegrouping')->__('General'),
            'title'     => Mage::helper('netgroup_attributegrouping')->__('General'),
            'content'   => $this->getLayout()->createBlock('netgroup_attributegrouping/adminhtml_form_edit_tab_general')->toHtml(),
        ));

        $product_content = $this->getLayout()->createBlock('netgroup_attributegrouping/adminhtml_form_edit_tab_product', 'adminform_products.grid')->toHtml();
        $serialize_block = $this->getLayout()->createBlock('adminhtml/widget_grid_serializer');
        $serialize_block->initSerializerBlock('adminform_products.grid', 'getSelectedProducts', 'products', 'selected_products');
        $serialize_block->addColumnInputName('position');
        $product_content .= $serialize_block->toHtml();
        $this->addTab('associated_products', array(
            'label'     => Mage::helper('netgroup_attributegrouping')->__('Products'),
            'title'     => Mage::helper('netgroup_attributegrouping')->__('Products'),
            'content'   => $product_content
        ));

        return parent::_beforeToHtml();
    }

}

And the content of the netgroup_attributegrouping.xml from the layout(design/default/default/layout) is :

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

    <attributegrouping_index>
        <update handle="editor"/>
        <reference name="content">
            <block type="netgroup_attributegrouping/adminhtml_form_edit" name="attributegrouping"/>
        </reference>
        <reference name="left">
            <block type="netgroup_attributegrouping/adminhtml_form_edit_tabs" name="attributegrouping_tabs"/>
        </reference>
    </attributegrouping_index>

</layout>

This is what i got :enter image description here

  • any ideea what could be the problem ? – Attila Naghi Jul 25 '14 at 7:58
1

Have you tried netgroup_attributegrouping before="Mage_Adminhtml"? I think the fields need to be added before the Mage_Adminhtml renders the whole thing. At least that's how my modules are configured.

p.s. lacking the reputation to comment, this became and answer instead.

Edit: Add the acl in the adminhtml.xml under the <menu> tag like this:

<acl>
    <resources>
        <admin>
            <children>
                <attributegrouping translate="title" module="attributegrouping">
                    <title>Attribute Grouping</title>
                        <children>
                            <new_group translate="title">
                                <title>Add new group</title>
                            </new_group>
                        </children>
                    </attributegrouping>
                </children>
            </admin>
        <resources>
    </acl>

It follows the same structure as your menu, and the titles you enter are the titles you see in the backends user rights management. You can also set a sort order to order these in the rights management list.

Edit 3: You can try to add your block programmatically to check whether your layout is malconfigured and which block path indeed works:

$this->loadLayout();
$this->_addContent($this->getLayout()->createBlock('{block-handle as in config.xml}/{block's path relative to Block-folder}');
$this->renderLayout();

Edit 4:

<?php 
class Netgroup_Attributegrouping_Helper_Data extends Mage_Core_Helper_Abstract
{}

this needs to go into Netgroup/Attributegrouping/Helper/Data.php

  • I tried before, after and still im getting nothing. if i write echo 1; exit(); in the Tabs.php , also im getting nothing. It does not reach the class from the Tabs.php. Smth somewhere my xml does not work and I dont know why. Any other ideea? thx for helping me :) – Attila Naghi Jul 25 '14 at 8:16
  • Do you set your ACL somewhere? You need to manage permissions to view your custom menus. – user3154108 Jul 25 '14 at 8:21
  • nope. how can i do that ? – Attila Naghi Jul 25 '14 at 8:24
  • check my post again and see the acl, but i still get nothing, blank page – Attila Naghi Jul 25 '14 at 8:26
  • now i the item from the main menu just disapperead – Attila Naghi Jul 25 '14 at 8:34

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.