Aby dodać nowy przycisk do grid’a w adminie należy w pliku {Namespace}/{Module}/Block/Adminhtml/{Entity}/Grid.php
dodać metodę getMainButtonsHtml
.
1 2 3 4 5 6 7 8 9 10 |
public function getMainButtonsHtml() { $html = parent::getMainButtonsHtml(); $addButton = $this->getLayout()->createBlock('adminhtml/widget_button') ->setData(array( 'label' => Mage::helper('adminhtml')->__('Nowy przycisk'), 'onclick' => "setLocation('".$this->getUrl('module/controller/action')."')", 'class' => 'nowy-przycisk' ))->toHtml(); return $addButton.$html; } |
Efekt poniżej.