php – 在magento中设置质量操作复选框可见性的条件
发布时间:2020-12-13 22:52:20 所属栏目:PHP教程 来源:网络整理
导读:我有一个magento模块,我正在开发用于将产品导入magento. 我有一个网格,用户可以选择他的产品,然后全部导入(Mass Action). 如果用户已经在列表中导入了产品,那么它将显示在网格中,但用户不应选择它(选中它的产品复选框)以避免重新导入产品. 我的问题是,如何为
我有一个magento模块,我正在开发用于将产品导入magento.
我有一个网格,用户可以选择他的产品,然后全部导入(Mass Action). 如果用户已经在列表中导入了产品,那么它将显示在网格中,但用户不应选择它(选中它的产品复选框)以避免重新导入产品. 我的问题是,如何为群发行动复选框可见性添加条件? 这是我的Grid的_prepareMassaction: protected function _prepareMassaction() { $this->setMassactionIdField('sku'); $this->getMassactionBlock()->setFormFieldName('import'); $this->getMassactionBlock()->setUseSelectAll(false); $this->getMassactionBlock()->addItem('import',array( 'label' => Mage::helper('import')->__('Import'),'url' => $this->getUrl('*/*/massImport'),'confirm' => Mage::helper('import')->__('Are you sure?') )); return $this; } 有人帮忙吗? 解决方法
嘿伙计你可以根据你的要求使用下面的代码
$ids = $this->getRequest()->getParam('sliders'); if (!is_array($ids)) { $this->_getSession()->addError($this->__('Please select items.')); } else { try { foreach ($ids as $id) { $model = Mage::getSingleton('sliders/sliders')->load($id); $model->delete(); } $this->_getSession()->addSuccess( $this->__('Total of %d record(s) have been deleted.',count($ids)) ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { $this->_getSession()->addError(Mage::helper('contact')->__('An error occurred while mass deleting contacts. Please review log and try again.')); Mage::logException($e); return; } } $this->_redirect('*/*/index'); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |