Сетка дисплея в модуле администрирования Magento

Я изучаю разработку модуля Magento. Я пытаюсь разработать пользовательский модуль для панели администрирования Magento. Я хотел бы отобразить сетку. Мои коды следующие

Расположение: приложение / etc / modules

Digitab_Brandlogo.xml

<?xml version="1.0" encoding="utf-8"?>
<config>
<modules>
<Digitab_Brandlogo>
<active>true</active>
<codePool>local</codePool>
</Digitab_Brandlogo>
</modules>
</config>

Расположение: приложение / код / ​​локальное / Digitab / Brandlogo / Block / Adminhtml

Brandlogo.php

<?php
class Digitab_Brandlogo_Block_Adminhtml_Brandlogo extends Mage_Adminhtml_Block_Widget_Grid_Container
{
public function __construct()
{
$this->_controller = 'adminhtml_brandlogo';
$this->_blockGroup = 'brandlogo';
$this->_headerText = Mage::helper('digitab_brandlogo')->__('Brand Logo Manager');
$this->_addButtonLabel = Mage::helper('digitab_brandlogo')->__('Add Brand');
parent::__construct();
}

protected function _prepareLayout()
{
$this->setChild('grid',$this->getLayout()->createBlock( $this->_blockGroup.'/' . $this->_controller . '_grid',    $this->_controller . '.grid')->setSaveParametersInSession(true) );
return parent::_prepareLayout();
}
}

Расположение: приложение / код / ​​локальное / Digitab / Brandlogo / Блок / Adminhtml / Brandlogo / Grid.php

<?php

class Digitab_Brandlogo_Block_Adminhtml_Brandlogo_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
public function __construct()
{
parent::__construct();
$this->setId('brand_id');
$this->setDefaultSort('brand_id');
$this->setDefaultDir('ASC');
$this->setSaveParametersInSession(true);
$this->setUseAjax(true);
}

protected function _prepareCollection()
{
$collection = Mage::getResourceModel('digitab_brandlogo/brandlogo_collection');
$this->setCollection($collection);
return parent::_prepareCollection();
}

public function getRowUrl($row)
{
return $this->getUrl('digitab_brandlogo_admin/brandlogo/edit',array('id' => $row->getId()));
}protected function _prepareColumns()
{
$this->addColumn('brand_id', array(
'header' => $this->_getHelper()->__('brand_id'),
'type' => 'number',
'index' => 'brand_id',
));$this->addColumn('brand_name',
array(
'header'=> $this->__('brand_name'),
'index' => 'brand_name'
)
);

return parent::_prepareColumns();
}protected function _getHelper()
{
return Mage::helper('digitab_brandlogo');
}
}

Расположение: приложение / код / ​​локальное / Digitab / Brandlogo / контроллеры / Adminhtml

BrandlogoController.php

<?php

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

public function gridAction()
{
$this->loadLayout();
$this->getResponse()->setBody($this->getLayout()->createBlock('digitab_brandlogo/adminhtml_brandlogo')->toHtml());
}
}

местоположение: приложение / код / ​​местное / Digitab / Brandlogo / и т. д.

config.xml

<?xml version="1.0"?>
<config>
<modules>
<digitab_brandlogo>
<version>1.0.0</version>
</digitab_brandlogo>
</modules>
<global>
<helpers>
<digitab_brandlogo>
<class>Digitab_Brandlogo_Helper</class>
</digitab_brandlogo>
</helpers>
<blocks>
<brandlogo>
<class>Digitab_Brandlogo_Block</class>
</brandlogo>
</blocks>
<models>
<brandlogo>
<class>Digitab_Brandlogo_Model</class>
<resourceModel>digitab_brandlogo_resource</resourceModel>
</brandlogo>
<digitab_brandlogo_resource>
<class>Digitab_Brandlogo_Model_Resource</class>
<entities>
<brandlogo>
<table>digitab_brandlogo</table>
</brandlogo>
</entities>
</digitab_brandlogo_resource>
</models>
<resources>
<brandlogo_setup>
<setup>
<brandlogo>digitab_brandlogo</brandlogo>
</setup>
<connection>
<use>core_setup</use>
</connection>
</brandlogo_setup>
<brandlogo_write>
<connection>
<use>core_write</use>
</connection>
</brandlogo_write>
<brandlogo_read>
<connection>
<use>core_read</use>
</connection>
</brandlogo_read>
</resources>
</global>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<digitab_brandlogo before="Mage_Adminhtml">Digitab_Brandlogo_Adminhtml</digitab_brandlogo>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<adminhtml>
<layout>
<updates>
<brandlogo>
<file>brandlogo.xml</file>
</brandlogo>
</updates>
</layout>
</adminhtml>
</config>

местоположение: приложение / код / ​​местное / Digitab / Brandlogo / и т. д.

adminhtml.xml

<?xml version="1.0"?>
<config>
<menu>
<digitab translate="title" module="digitab_brandlogo">
<title>Digitab</title>
<sort_order>110</sort_order>
<children>
<brandlogo>
<title>Brand Logo</title>
<sort_order>1</sort_order>
<action>adminhtml/brandlogo/index</action>
</brandlogo>
</children>
</digitab>
</menu>
</config>

местоположение: приложение / код / ​​местное / Digitab / Brandlogo / Helper

Data.php

<?php
class Digitab_Brandlogo_Helper_Data extends Mage_Core_Helper_Abstract
{
}

расположение: приложение / код / ​​локальное / Digitab / Brandlogo / модель / Brandlogo.php

<?php
class Digitab_Brandlogo_Model_Brandlogo extends Mage_Core_Model_Abstract
{
protected function _construct()
{
parent::_construct();
$this->_init('digitab_brandlogo/brandlogo');
}
}

расположение: приложение / код / ​​локальное / Digitab / Brandlogo / модель / ресурс / Brandlogo.php

<?php
class Digitab_Brandlogo_Model_Resource_Brandlogo extends Mage_Core_Model_Resource_Db_Abstract
{
protected function _construct()
{
$this->_init('digitab_brandlogo/brandlogo','brand_id');
}
}

Расположение: приложение / код / ​​местные / Digitab / Brandlogo / Модель / Resource / Brandlogo / Collection.php

<?php
class Digitab_Brandlogo_Model_Resource_Brandlogo_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
{
protected function _construct()
{
parent::_construct();
$this->_init('digitab_brandlogo/brandlogo');
}
}

расположение: приложение / дизайн / adminhtml / default / default / layout

brandlogo.xml

<?xml version="1.0"?>
<layout version="0.1.0">
<adminhtml_brandlogo_index>
<reference name="content">
<block type="brandlogo/adminhtml_brandlogo" name="brandlogo" />
</reference>
</adminhtml_brandlogo_index>
</layout>

Я нашел ошибку в exception.log как показано ниже

exception 'Mage_Core_Exception' with message 'Invalid block type: Digitab_Brandlogo_Block_Brandlogo' in /home3/theaid/public_html/demo/app/Mage.php:595

Я получаю пустую белую страницу, когда нажимаю на меню Brandlogo в Digitab.

Может ли кто-нибудь помочь мне отобразить сетку ??

Спасибо

2

Решение

1.Неправильно использовать путь в приложении / коде / локальном / Digitab / Brandlogo / Block / Adminhtml / Brandlogo.php

использовать как это

$this->_headerText = Mage::helper('digitab_brandlogo')->__('Brand Logo Manager');

вместо

$this->_headerText = Mage::helper('brandlogo')->__('Brand Logo Manager');
  1. У вас нет установочного файла для ресурса
0

Другие решения

Других решений пока нет …