· Thilanga Pitigala

Thilanga Pitigala     Archive     Feed

Adding Observers to Magento Events

  1. To write an Observer you need minimum of 2 files

    1. etc/config.xml (Details about the EVENT_TO_HOOK and the area [frontend|adminhtml])
    2. Model/Observer.php (Your php code goes here)
  2. Find the event you want

    1. http://www.nicksays.co.uk/magento-events-cheat-sheet-1-8/

Sample

Remove an action from Mass Action list in admin (Order list page)

config.xml
    <adminhtml> <!-- Area -->
        <events>
            <adminhtml_block_html_before> <!-- EVENT_TO_HOOK you want to bind with -->
                <observers>
                    <adminhtml_block_html_before> <!-- Your unique tag name -->
                        <class>Acme_Adminhtml_Model_observer</class>  <!-- Your custom Observer -->
                        <method>removeMassAction</method> <!--Method you want to trigger -->
                    </adminhtml_block_html_before>
                </observers>
            </adminhtml_block_html_before>
        </events>
    </adminhtml>
Observer.php
<?php

class Acme_Adminhtml_Model_Observer extends Varien_Object
{
    public function removeMassAction($event) {

        $block = $event->getBlock();
        if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction) {
            $block->removeItem('hold_order');
            $block->removeItem('unhold_order');

            return $this;
        }
    }
}

Test Credit Card Numbers for Payment Gateways

Notes to Myself

MIGS (ANZ Bank, Bendigo Bank, Suncorp Bank, Commonwealth Bank CommWeb)

Card Type Number Expiry Date CCV
MasterCard 5123456789012346 05/17 123
MasterCard 5313581000123430 05/17 123
VISA 4005550000000001 05/17 123
VISA 4557012345678902 05/17 123
AMEX 345678901234564 05/17 1234
Bankcard (Australian Domestic) 5610901234567899 05/17 123
Diners Club 30123456789019 05/17 123