0

I have created a Module and need to have a separate tab (grid) in Magento backend (next to Dashboard or any other menu item) to display customer comments (that are stored in the separate database table of this module) in that grid.

Created a file adminhtml.xml using this article http://alanstorm.com/magento_admin_hello_world_revisited/ and added the code below, but I'm getting an error.

<?xml version="1.0"?>
 <config>
 <menu>
 <cpstest translate="title" module="cpstest_productcomments">
            <title>Allow Comments</title>
            <sort_order>1</sort_order>
            <children>
                <example>
                    <title>CPS Product Comments</title>
                    <sort_order>1</sort_order>
                    <action>adminhtml/productcomments/index</action>
                </example>
            </children>
        </cpstest>
    </menu>
</config>

And this is the module's config.xml file

<config>
    <modules>
        <Cpstest_ProductComments>
            <version>0.1.0</version>
        </Cpstest_ProductComments>
    </modules>
    <frontend>    
        <layout>
            <updates>
                <productcomments module="Cpstest_ProductComments">
                    <file>productcomments.xml</file>
                </productcomments>
            </updates>
        </layout>
        <routers>
            <productcomments>
                <use>standard</use>
                <args>
                    <module>Cpstest_ProductComments</module>
                    <frontName>productcomments</frontName>
                </args>
            </productcomments>
        </routers>
    </frontend>
    <global>
        <models>
            <productcomments>
                <class>Cpstest_ProductComments_Model</class>
            </productcomments>
        </models>       
         <resources>
         <productcomments_setup>
                <setup>
                    <module>Cpstest_ProductComments</module>
                    <class>Mage_Eav_Model_Entity_Setup</class>
                   <class>Cpstest_ProductComments_Model_Resource_Mysql4_Setup</class>
                    <class>Mage_Catalog_Model_Resource_Setup</class> <!---->
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </productcomments_setup>   
            <productcomments_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </productcomments_write>
            <productcomments_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </productcomments_read>
        </resources> 
        <helpers>
            <productcomments>
                <class>Cpstest_ProductComments_Helper</class>                                                             
            </productcomments>            
        </helpers>
    </global>
<adminhtml>
        <acl>
            <resources>
                <admin>
                    <children>
                        <system>
                            <children>
                                <config>
                                    <children>
                                        <productcomments_options>
                                            <title>Product Comments</title>
                                        </productcomments_options>
                                    </children>
                                </config>
                            </children>
                        </system>
                    </children>
                </admin>
            </resources>
        </acl>
    </adminhtml>
</config>
6
  • Please add details about the error you are facing Commented Mar 9, 2017 at 3:12
  • @Jaimin Sutariya I added the error message. Thanks for your reply. Commented Mar 9, 2017 at 18:06
  • Check my answer and let me know if any other issue. Commented Mar 9, 2017 at 18:11
  • @Jaimin Sutariya thanks so much, now that error is gone and the tab is there :) But the link takes to 404 page. Commented Mar 9, 2017 at 19:26
  • Did you create controller file? It should be on Cpstest/ProductComments/controllers/Adminhtml/ProductcommentsController.php, if yes, please add code for your file here. Also add code for your layout file in design/adminhtml/default/default/layout/YOUR_LAYOUT_FILE.xml Commented Mar 9, 2017 at 19:31

2 Answers 2

2

Create a file Cpstest/ProductComments/Helper/Data.php with below code

<?php 
class Cpstest_ProductComments_Helper_Data extends Mage_Core_Helper_Abstract{
}



EDIT

The module name you are using in your adminhtml.xml is wrong. Update your adminhtml.xml with below

<?xml version="1.0"?>
 <config>
    <menu>
        <cpstest translate="title" module="productcomments">
            <title>Allow Comments</title>
            <sort_order>1</sort_order>
            <children>
                <example>
                    <title>CPS Product Comments</title>
                    <sort_order>1</sort_order>
                    <action>adminhtml/productcomments/index</action>
                </example>
            </children>
        </cpstest>
    </menu>
</config>
3
  • Hi @Jaimin Sutariya , the problem is I already had that exact same code in my helper, but still getting the error. (I cleared the cache) Commented Mar 9, 2017 at 18:45
  • @bestwebdevs, Check my edit to the answer. Commented Mar 9, 2017 at 18:55
  • I will create a separate question for the rest of the issue. Thanks for your help @Jaimin Sutariya Commented Mar 9, 2017 at 23:25
0

Read the below blog that is explained how to use external database connection in Magento.

Create An External Database Connection in Magento

If you able to connect of your external database, then its the same procedure to develop custom grid implementation

1
  • Thanks for your help @Supravat. Think that's not exactly what I need though. Commented Mar 9, 2017 at 23:27

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.