1

I am working on a custom module, Grid section is working fine, I want to view the data in my custom tab,

This is my code.

app/code/local/Folder/Modulename/Block/Adminhtml/Adminquote/View/Tabs.php

$this->addTab("form_section", array(
        "label" => Mage::helper("adminquote")->__("Quotation Details"),
        "title" => Mage::helper("adminquote")->__("Quotation Details"),
        "content" => $this->getLayout()->createBlock("adminquote/adminhtml_adminquote_view_tab_info")->toHtml(),
        "active" => true
));

app/code/local/Folder/Modulename/Block/Adminhtml/Adminquote/View/Tab/Info.php

class Folder_Modulename_Block_Adminhtml_Adminquote_View_Tab_Info extends Mage_Adminhtml_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface
{
    protected function _construct()
    {
      parent::_construct();
      $this->setTemplate('adminquote/view/info.phtml');
    }
}

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

<adminquote_adminhtml_adminquote_view_tab_info>
<reference name="content">
   <action method="addTab">
      <name>adminhtml_adminquote_view_tab</name>
      <block>adminquote/adminhtml_adminquote_view_tab_info</block>
   </action>
 </reference>

etc/config.xml

<?xml version="1.0"?>
<config>
<modules>
    <Folder_Modulename>
        <version>1.0.1</version>
    </Folder_Modulename>
</modules>
<global>
    <blocks>
        <Folder_Modulename>
            <class>Folder_Modulename_Block</class>
        </Folder_Modulename>
    </blocks>
</global>       
<adminhtml>
   <layout>
        <updates>
            <modulename>
                <file>adminquote.xml</file>
            </modulename>
        </updates>
    </layout>
</adminhtml>
</config>

I am getting error in system.log

2019-01-09T11:52:36+00:00 CRIT (2): Not valid template file:adminhtml/base/default/template/adminquote/view/Info.phtml

Info.phtml file exists in that path.

I don't know why its showing template not valid, Can anyone suggest me to fix this,

Thanks.

2
  • Paste your module config.xml too Commented Jan 9, 2019 at 12:27
  • @Raghul Sanchez, I have updated my config.xml, please check. Commented Jan 9, 2019 at 12:54

1 Answer 1

0

There are several things wrong in your layout file

<adminquote_adminhtml_adminquote_view_Tabs_Info>
    <reference name="content">
        <block type="adminquote/adminquote_adminhtml_adminquote_view_Tabs_Info" name="adminquote_adminhtml_adminquote_view_Tabs_Info" />
    </reference>
</adminquote_adminhtml_adminquote_view_Tabs_Info>

The identifier adminquote_adminhtml_adminquote_view_Tabs_Info should correspond to a controller action, or a layout handle. You'd fix that first, according to how your module is implemented

I don't see any admin router defined in your config.xml file, so I suppose you want to inject your custom tab in an existing Magento module. If that's the case, here you have an example about how to do that https://makandracards.com/magento/10947-add-a-tab-to-the-admin-product-screen

Next, your block type is wrong

According to the config.xml you've pasted the block type should be Folder_Modulename/adminhtml_adminquote_view_tabs_info (capital letters are totally relevant, unless you are working under a Windows system... and I hope that's not your case). This applies both for the layout file & the class where you define the block for your tab (app/code/local/Folder/Modulename/Block/Adminhtml/Adminquote/View/Tabs.php)

Once this 2 problems are fixed, the template path loaded by application should be app/design/adminhtml/default/default/template/adminquote/view/Info.phtml (again, capital letters are totally relevant)

6
  • @rahul Sanchez, The identifier adminquote_adminhtml_adminquote_view_Tabs_Info should correspond to a controller action or a layout handle. Can you please explain this. Commented Jan 10, 2019 at 6:25
  • As my understanding, it does not correspond to the controller action. (If you need module code, I can zip it and send to you.) Commented Jan 10, 2019 at 6:36
  • 1
  • I went through the link as you mentioned above, Commented Jan 10, 2019 at 7:28
  • In my custom module form edit and update are working fine, I just want to view my data like order view page. For that only it's giving an error. Layout updates are working for edit and updates. Commented Jan 10, 2019 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.