我一直在爲magento後端編寫一個自定義缺貨模塊,我有批量操作,導出等工作。但是,當我做任何類型的搜索功能(如在產品名稱字段中放入某些東西),並確實嘗試切換到下一頁(或在該字段中輸入特定頁面)或頁面上顯示多少產品。它立即將我重定向到儀表板。Magento - 自定義管理網格問題
任何人都可以指出我正確的方向,哪裏的代碼是處理這個功能?我將假設其控制器的一部分,但我一直在尋找最後一個小時,現在是時候尋求幫助!
感謝您提供任何幫助!
準備列功能:
protected function _prepareColumns()
{
$this->addColumn('sku',
array(
'header'=> Mage::helper('catalog')->__('SKU'),
'width' => '80px',
'index' => 'sku',
));
$sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
->load()
->toOptionHash();
$this->addColumn('set_name',
array(
'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
'width' => '60px',
'index' => 'attribute_set_id',
'type' => 'options',
'options' => $sets,
));
$store = $this->_getStore();
if ($store->getId()) {
$this->addColumn('custom_name',
array(
'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()),
'index' => 'custom_name',
));
}
$this->addColumn('name',
array(
'header'=> Mage::helper('catalog')->__('Name'),
'index' => 'name',
));
$this->addColumn('stock_status',
array(
'header'=> 'Availability',
'width' => '60px',
'index' => 'stock_status',
'type' => 'options',
'options' => array('1'=>'In stock','0'=>'Out of stock'),
));
$this->addColumn('custom_stock_status',
array(
'header' => 'Custom Stock Status',
'width' => '60px',
'index' => 'custom_stock_status',
'type' => 'options',
'editable' => 'true',));
$this->addColumn('eol',
array(
'header'=> Mage::helper('catalog')->__('EoL'),
'width' => '20px',
'type' => 'checkbox',
'index' => 'eol',
'onclick' => 'this.value = this.checked ? 1 : 0;',
'values' => array('1','2'),
'editable' => 'true',
));
$store = $this->_getStore();
$this->addColumn('qty',
array(
'header'=> Mage::helper('catalog')->__('Qty'),
'width' => '25px',
'type' => 'number',
'index' => 'qty',
));
$this->addColumn('status',
array(
'header'=> Mage::helper('catalog')->__('Status'),
'width' => '70px',
'index' => 'status',
'type' => 'options',
'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
));
$this->addColumn('action',
array(
'header' => Mage::helper('catalog')->__('Action'),
'width' => '90px',
'type' => 'action',
'getter' => 'getId',
'actions' => array(
array(
'caption' => Mage::helper('catalog')->__('Edit Product'),
'url' => array(
'base'=>'store_admin/catalog_product/edit',
'params'=>array('store'=>$this->getRequest()->getParam('store'))
),
'field' => 'id'
)
),
'filter' => false,
'sortable' => false,
'index' => 'stores',
));
$this->addRssList('rss/catalog/notifystock', Mage::helper('catalog')->__('Notify Low Stock RSS'));
return parent::_prepareColumns();
}
而且我試圖通過屬性篩選,我需要爲了過濾兩次相同屬性的輸出都爲空,沒有屬性,但也不是。無論如何要做到這一點?
->addAttributeToFilter('eol', array('null' => true), 'left')
->addAttributeToFilter('eol', array('No' => true));
這就是我現在要做的,但是,它絲毫不起作用。兩個人都很好!