Magento定制模块,带有定制数据库表管理页面 [英] Magento custom module with custom database table admin page

查看:107
本文介绍了Magento定制模块,带有定制数据库表管理页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我关注了Wiki帖子,以使用自定义数据库表设置自定义模块.

I have followed a wiki post to setup a custom module with a custom database table.

http://www.magentocommerce.com/wiki/5_- _modules_and_development/0 _-_ module_development_in_magento/custom_module_with_custom_database_table

我无法解决的一件事是如何在管理后端中显示数据库条目的列表.关于我所缺少的任何想法将不胜感激?

One thing that I can't work out is how to display a list of database entries in the admin backend. Any ideas about what I'm missing would be greatly appreciated?

推荐答案

下面的代码是在管理面板中查看自定义表格数据的简单方法

Below Code is simple method to view your custom table datas in admin panel

自定义模块的管理员视图:

Admin view for your custom module :

在模块中创建以下路径:

Create the below path in your module :

/app/code/local/<Namespace>/<Module>/etc/adminhtml.xml

adminhtml.xml 文件中的

包含以下内容

in adminhtml.xml file contain below content

<?xml version="1.0"?>
<config>
    <menu>
        <[module] module="[module]">
            <title>[Module]</title>
            <sort_order>71</sort_order>               
            <children>
                <items module="[module]">
                    <title>Manage Items</title>
                    <sort_order>0</sort_order>
                    <action>[module]/adminhtml_[module]</action>
                </items>
            </children>
        </[module]>
    </menu>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <[module]>
                        <title>[Module] Module</title>
                        <sort_order>200</sort_order>
                    </[module]>
                </children>
            </admin>
        </resources>   
    </acl>
    <layout>
        <updates>

创建Adminhtml文件夹并创建Controller.php文件

Create the Adminhtml folder and create Controller.php file

/app/code/local/<Namespace>/<Module>/controllers/Adminhtml/<Module>Controller.php

<Module>Controller.php文件中的

包含以下内容

in <Module>Controller.php file contain below content

<?php 
class <Namespace>_<module>_Adminhtml_<module>Controller extends Mage_Adminhtml_Controller_Action
{

    public function indexAction()
    {
            $this->loadLayout()->_setActiveMenu('<module>/items');
            $this->renderLayout();

    }   

}

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

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

包含以下内容

<?xml version="1.0"?>
<layout version="0.1.0">
    <[module]_adminhtml_[module]_index>
        <reference name="content">
            <block type="core/template" name="domain" template="[module]/[module].phtml"/>
        </reference>
    </[module]_adminhtml_[module]_index>
</layout>

在路径下方创建新文件夹

Create the new folder in below path

app/design/adminhtml/default/default/template/<module>/<module>.phtml

<module>.phtml文件中的

包含以下内容

in <module>.phtml file contain below content

<?php

// Write your custom table Collection Here

?>

这篇关于Magento定制模块,带有定制数据库表管理页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆