0

enter image description hereI am using Magento 1.9.1 .

I will create new mass action same like Print Packingslips in order grid also download pdf for same as Print Packingslips but some customization in pdf as per requirement.any one create any module or else knowing step so please share.

2

Flow below steps

Step:1

Create file Ar_Custom.xml at location app\etc\modules and add below code

<?xml version="1.0"?>
<config>
    <modules>
        <Ar_Custom>
            <active>true</active>
            <codePool>community</codePool>
        </Ar_Custom>
    </modules>
</config>

Step:2 Create Observer.php at location app\code\community\Ar\Custom\Model\

<?php
class Ar_Custom_Model_Observer
{
    public function addMassAction($observer)
    {
        $block = $observer->getEvent()->getBlock();
        $this->_block = $block;
        if (get_class($block) == 'Mage_Adminhtml_Block_Widget_Grid_Massaction' && $block->getRequest()->getControllerName() == 'sales_order') {
            $block->addItem('custom_action', array(
                'label' => Mage::helper('sales')->__('Custom Action'),
                'url' => $block->getUrl('*/custom/masscustom'),
            ));
        }
    }
}

Step:3 Create CustomController.php file at location app\code\community\Ar\Custom\controllers\Adminhtml\CustomController.php and below code

<?php
class Ar_Custom_Adminhtml_CustomController extends Mage_Adminhtml_Controller_Action
{

    public function massCustomAction()
    {
        $orderIds = $this->getRequest()->getPost('order_ids', array());
        $this->_redirect('adminhtml/sales_order/');
    }
}

Step:4 Create config.xml file at location app\code\community\Ar\Custom\etc and add below code

<?xml version="1.0"?>
<config>
    <modules>
        <Ar_Custom>
            <version>1.0.1</version>
        </Ar_Custom>
    </modules>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <Ar_Custom after="Mage_Adminhtml">Ar_Custom_Adminhtml</Ar_Custom>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
     <adminhtml>
        <events>
            <core_block_abstract_prepare_layout_before>
                <observers>
                    <newmodule_core_block_abstract_prepare_layout_before>
                        <type>model</type>
                        <class>Ar_Custom_Model_Observer</class>
                        <method>addMassAction</method>
                    </newmodule_core_block_abstract_prepare_layout_before>
                </observers>
            </core_block_abstract_prepare_layout_before>
        </events>
    </adminhtml>
    <global>
        <models>
            <custom>
                    <class>Ar_Custom_Model</class>
            </custom>
        </models>
        <resources>
            <custom_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </custom_write>
            <custom_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </custom_read>
        </resources>
    </global>
</config>

Step:5 Flush and refresh all cache in admin end.

  • This one is not working i follow your step but not display. – meet Dec 8 '17 at 11:08
  • have you clear cache? – Abdul Dec 8 '17 at 11:18
  • yes but not working – meet Dec 8 '17 at 11:25
  • magento.stackexchange.com/questions/45786/… using this i will create custom option but after this step what i don't know if you know then please tell me step. – meet Dec 8 '17 at 11:30
  • my code working fine my end. can u please check module setup or not? – Abdul Dec 8 '17 at 12:09

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.