在前端magento显示员工

时间:2013-12-10 12:46:16

标签: php magento tabs grid

我创建了一个管理网格和标签,用于在我的项目中添加新员工。如何在点击链接时显示我网站前端的这些员工(插入数据库),例如全部列出。该链接在我的主页上。

<li class="level0 nav-3 level-top parent">
            <a href="<?php echo Mage::getBaseUrl() ?>employee/index/list" class="nav_left">
                <span class="nav_right">
                    <span class="nav_inner_container">List All</span>
                </span>
            </a>
        </li>

这将是链接。网址可能是project.com/employee/index/list。

我是否必须为此创建任何 phtml 文件?

我对Magento很新。请帮我解决这个问题。

2 个答案:

答案 0 :(得分:1)

you can find many way to do this

这是我认为使用查询

的简单方法
 $resource = Mage::getSingleton('core/resource');   
    $readConnection = $resource->getConnection('core_read');
    $query = 'SELECT * FROM employee_master ';
    $results = $readConnection->fetchAll($query);
    print_r($results);

此处$results您可以找到所有详细信息,只需将结果格式化为您的方式。employee_master是示例表名称write your table name

答案 1 :(得分:0)

使用Magento模型和集合。 也许这个链接可以帮助你解决这个问题:

http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-5-magento-models-and-orm-basics