I'm trying to add a button on the cache page, next to the "Flush Cache Storage" button. My approach is to overwrite the block "Mage_Adminhtml_Block_Cache". But I can't get it to work. Does anyone know what I'm doing wrong?


<?xml version="1.0"?>



    class Mymodule_FlushImages_Block_Adminhtml_Cache extends Mage_Adminhtml_Block_Cache
         * Class constructor
        public function __construct()
            $this->_addButton('flush_magento', array(
                'label'     => Mage::helper('core')->__('Flush Images'),
                'onclick'   => 'setLocation(\'' . $this->getFlushImagesUrl() .'\')',
                'class'     => 'delete',


         * Get url for delete Images
        public function getFlushImagesUrl()
            return $this->getUrl('*/*/flushImages');

Note: I did create the module config file in app/etc/modules.

Help is highly appreciated.


your line:


should be replaced with:

  • 1
    also if you want to put your button after "Flush Cache Storage" then at first line call parrent constructor and after that add you button. – Rostislav Sabischenko Feb 17 '16 at 20:00
  • Thanks! I fixed the block node but unfortunately the button still does not show up (ie I updated my initial question so its more specific. – Stefan Feb 18 '16 at 10:08
  • It couldn't work in your case because you created button with ID flush_magento and then run _construct which replaces your button with Magento native button. I mentioned to use construct before your code. Also specify unique ID for button. – Rostislav Sabischenko Feb 18 '16 at 16:26
  • Thanks Rostislav. You are right! This works. Gonna except your answer because it matches more the initial question. – Stefan Feb 19 '16 at 9:27

Finally I found a way - by using an model/observer:




class Mymodule_FlushImages_Model_Observer
    public function addButton($observer) {

        $block = $observer->getEvent()->getBlock();
        if(get_class($block) == 'Mage_Adminhtml_Block_Cache') {
            $button = $block->addButton('clearimages', array(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.