I have created a custom module with the form and form is saving the data to DB perfectly now i want to show all the data in my admin Grid custom page.
I have tried it but when ever i visit the page it goes to 404
Here is my review.xml file where i defined the menu in the directory app > design > adminhtml > default > default > layout with the following code in it:
<? xml version = "1.0" ?>
<layout version="0.1.0">
<reviewmycompany_adminhtml_review_index>
<reference name="content">
<block type="reviewmycompany/adminhtml_review" name="review" />
</reference>
</reviewmycompany_adminhtml_review_index>
</layout>
And have my ReviewController.php in app > code > community > OptFirst > ReviewMyCompany > controllers > adminhtml with the following code:
<?php
class OptFirst_ReviewMyCompany_Adminhtml_ReviewController extends Mage_Adminhtml_Controller_action
{
public function indexAction() {
$this->loadLayout();
$this->renderLayout();
}
public function gridAction()
{
$this->loadLayout();
$this->getResponse()->setBody(
$this->getLayout()->createBlock('reviewmycompany/adminhtml_review_grid')->toHtml()
);
}
}
And my Review.php file in app > code > community > OptFirst > ReviewMyCompany > Block > adminhtml as follows
<?php
class OptFirst_ReviewMyCompany_Block_Adminhtml_Review extends Mage_Adminhtml_Block_Widget_Grid_Container
{
public function __construct()
{
$this->_controller = 'adminhtml_review';
$this->_blockGroup = 'review';
$this->_headerText = Mage::helper('optfirst_reviewmycompany')->__('Manage Social Icons');
$this->_addButtonLabel = Mage::helper('optfirst_reviewmycompany')->__('Add Employee');
parent::__construct();
}
}
And My Grid.php files in app > code > community > OptFirst > ReviewMyCompany > Block > adminhtml >Review with the following code:
<?php
class OptFirst_ReviewMyCompany_Block_Adminhtml_Review_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
public function __construct()
{
parent::__construct();
$this->setId('reviewGrid');
$this->setDefaultSort('id');
$this->setDefaultDir('ASC');
$this->setSaveParametersInSession(true);
}
protected function _prepareCollection()
{
$collection = Mage::getModel('optfirst_reviewmycompany/review')->getCollection();
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn('id', array(
'header' => Mage::helper('reviewmycompany')->__('ID'),
'align' =>'right',
'width' => '10px',
'index' => 'id',
));
$this->addColumn('name', array(
'header' => Mage::helper('reviewmycompany')->__('Name'),
'align' =>'left',
'index' => 'name',
'width' => '50px',
));
$this->addColumn('content', array(
'header' => Mage::helper('reviewmycompany')->__('Description'),
'width' => '150px',
'index' => 'content',
));
return parent::_prepareColumns();
}
}
So can you please look into this and let me know why it all happening why its going to 404?
Thanks!