Magento : add a button to the edit product page accessible to a specific resource acl -
i tried override block mage_adminhtml_block_catalog_product_edit , create button "delete_cache_product" way:
protected function _preparelayout() { parent::_preparelayout(); $this->_product = $this->getproduct(); $this->setchild('delete_cache_product', $this->getlayout()->createblock('adminhtml/widget_button') ->setdata(array( 'label' => mage::helper('catalog')->__('delete cache'), 'onclick' => 'confirmsetlocation(\''.mage::helper('catalog')->__('are sure?').'\', \''.$this->getdeletecacheproducturl().'\')', 'title' => mage::helper('catalog')->__('delete product cache?') )) ); homecoming $this; }
the problem how can associate resource acl button users have access such resources can see button???
create custom admin module acl then
if(mage::getsingleton('admin/session')->isallowed('admin/custommodulename')){ $this->setchild('delete_cache_product', $this->getlayout()->createblock('adminhtml/widget_button') ->setdata(array( 'label' => mage::helper('catalog')->__('delete cache'), 'onclick' => 'confirmsetlocation(\''.mage::helper('catalog')->__('are sure?').'\', \''.$this->getdeletecacheproducturl().'\')', 'title' => mage::helper('catalog')->__('delete product cache?') )) ); }
see http://alanstorm.com/magento_acl_authentication
magento button admin acl product
No comments:
Post a Comment