1

I'm trying to add some functionaltiy after generating invoice by magento store owner for orders. I'm using the following code

<sales_order_invoice_save_after> 
    <observers>
        <sales_order_invoice_save_after_handler> 
            <type>model</type> 
            <class>invoice/observer</class>
            <method>saveinvoiceno</method>  
        </sales_order_invoice_save_after_handler>
    </observers>
</sales_order_invoice_save_after>

Issue

Above code is also working PayPal payment, but i want to execute it for admin only. Any suggestion or help?

Thank you in advance.

2
  • Can you please give some feedback? Did it answer your question?
    – sv3n
    Commented Jul 2, 2017 at 8:29
  • issue is not resolved yet.
    – Ashvini K
    Commented Jul 3, 2017 at 5:19

1 Answer 1

1

If it should be for admin only, you have to put it inside adminhtml node:

<?xml version="1.0"?>
<config>
    <modules>
        ...
    </modules>
    <global>
        ...
    </global>
    <adminhtml>
        <events>
            <sales_order_invoice_save_after> 
                <observers>
                    <sales_order_invoice_save_after_handler> 
                        <type>model</type> 
                        <class>invoice/observer</class>
                        <method>saveinvoiceno</method>  
                    </sales_order_invoice_save_after_handler>
                </observers>
            </sales_order_invoice_save_after>
        </events>
    </adminhtml>
</config>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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