i am mới để Magento bằng cách làm theo hướng dẫn này Custom Module with Custom Database TableMagento mô-đun adminhtml tùy chỉnh nó hiển thị lưới hai lần
tôi đã thực hiện của tôi đã tồn tại mô-đun với adminhtml backend. Tôi đang lấy công cụ từ cơ sở dữ liệu và sjowing ot trên trang adminhtml. Tất cả mọi thứ hoạt động ok ngoại trừ tôi nhận được lưới hai lần trên adminhtml. tôi nhận được cùng một Grid hai lần. tôi đã xem mã cho như 2 giờ không thể tìm ra nó. nếu có ai biết làm thế nào để khắc phục vấn đề này tôi sẽ rất thakful. cổ vũ
thats mã từ grid.php tôi
<?php
class Ecom_Pricenotify_Block_Adminhtml_Pricenotify_Grid extends Mage_Adminhtml_Block_Widget_Grid{
public function __construct()
{
parent::__construct();
$this->setId('pricenotifyGrid');
// This is the primary key of the database
$this->setDefaultSort('pricenotify_id');
$this->setDefaultDir('ASC');
$this->setSaveParametersInSession(true);
}
protected function _prepareCollection()
{
$collection = Mage::getModel('pricenotify/pricenotify')->getCollection();
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn('pricenotify_id', array(
'header' => Mage::helper('pricenotify')->__('Notification ID'),
'align' =>'left',
'width' => '50px',
'index' => 'pricenotify_id',
));
$this->addColumn('prod_id', array(
'header' => Mage::helper('pricenotify')->__('Product ID'),
'align' =>'left',
'width' => '50px',
'index' => 'prod_id',
));
$this->addColumn('prod_price', array(
'header' => Mage::helper('pricenotify')->__('Product Price'),
'align' =>'left',
'width' => '50px',
'index' => 'prod_price',
));
$this->addColumn('user_price', array(
'header' => Mage::helper('pricenotify')->__('User Price'),
'align' =>'left',
'width' => '50px',
'index' => 'user_price',
));
$this->addColumn('email', array(
'header' => Mage::helper('pricenotify')->__('E-Mail Address'),
'align' =>'left',
'width' => '150px',
'index' => 'email',
));
$this->addColumn('created_time', array(
'header' => Mage::helper('pricenotify')->__('Creation Time'),
'align' => 'left',
'width' => '120px',
'type' => 'date',
'default' => '--',
'index' => 'created_time',
));
$this->addColumn('status', array(
'header' => Mage::helper('pricenotify')->__('Status'),
'align' => 'left',
'width' => '80px',
'index' => 'status',
'type' => 'options',
'options' => array(
'success' => 'Inactive',
'pending' => 'Active',
),
));
return parent::_prepareColumns();
}
public function getRowUrl($row)
{
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
}}
và chức năng indexAction này là từ bộ điều khiển
public function indexAction() {
$this->_initAction();
$this->_addContent($this->getLayout()->createBlock('pricenotify/adminhtml_pricenotify'));
$this->renderLayout();
}
Khám phá vùng chứa lưới hoặc cập nhật câu hỏi của bạn với vùng chứa lưới và layout.xml. – azakolyukin