Last active
August 29, 2015 14:11
-
-
Save akizor/19d4c81382020618c45b to your computer and use it in GitHub Desktop.
Magento Observer for Product/Orders Massactions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<events> | |
<core_block_abstract_prepare_layout_before> | |
<observers> | |
<massaction_observers> | |
<type>singleton</type> | |
<class>My_Awesome_Observer</class> | |
<method>addMassAction</method> | |
</massaction_observers> | |
</observers> | |
</core_block_abstract_prepare_layout_before> | |
</events> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function addMassAction($observer) { | |
$block = $observer->getEvent()->getBlock(); | |
if(!$block) { | |
return $this; | |
} | |
$store = Mage::app()->getStore(); | |
$storeId = Mage::app()->getStore()->getCode(); | |
if($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction) { | |
if($block->getRequest()->getControllerName() == 'sales_order') { | |
$block->addItem( | |
'pdfs', | |
array('label' => Mage::helper('adminhtml')->__('+ Print PDF Picking List'), | |
'url' => Mage::app()->getStore()->getUrl('*/pdfgen/generatePdfs') | |
) | |
); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment