如何使管理员无法删除Magento中的产品?

时间:2013-03-21 09:27:10

标签: magento roles

正如标题所说,我不想让管理员无法删除产品,但他可以添加或更新产品。

1 个答案:

答案 0 :(得分:0)

创建一个自定义模块,用于覆盖Mage_Adminhtml_Block_Catalog_Product_Edit和ACL。然后创建自定义角色并将这些用户分配给它

请参阅/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit.php

protected function _prepareLayout()
{
  .....
  if ($this->getProduct()->isDeleteable() && <acl>) {
      $this->setChild('delete_button',
      $this->getLayout()->createBlock('adminhtml/widget_button')
            ->setData(array(
                'label'     => Mage::helper('catalog')->__('Delete'),
                'onclick'   => 'confirmSetLocation(\''.Mage::helper('catalog')->__('Are you sure?').'\', \''.$this->getDeleteUrl().'\')',
                'class'  => 'delete'
            ))
    );
}

看看@ http://www.atwix.com/magento/view-product-button/