Our Blog: Extending Magento Gotcha

Aug17th

Comments Off

Extending Magento Gotcha

Tags for post entry: Extending Magento GotchaWritten by Jon Webb on July 17th, 2009, Posted in Development Ramblings |

Tags for post entry: Extending Magento Gotcha,

Well – it has to be said that I thoroughly enjoy Magento development, but today I came across an issue I’d never seen before.

This problem is down to extending Magento to observe certain events in the administration interface, call it hooking into events or whatever – but your essentially observing events which are triggered within Magento – these events then call your code and you can then manipulate Magento to your hearts content.

The problem I experienced was very simple. I just couldn’t work out why my code was not being triggered by an event. I knew that the event existed, and that my code was sound, and that my module config was correct. However in my method signature I had explicitly set the data type I was expecting, and the data type that Varien (the company who develops Magento) had documented – so my method signature should have been the following

public function emailSupplierFromInvoicePayment(Varian_Object $ob)
{
        die("event-trace");
}

When I’d actually set it to:

public function emailSupplierFromInvoicePayment(Varian_Event_Observer $ob)
{
        die("event-trace");
}

So much for explicit declaration.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • StumbleUpon
  • Technorati
  • LinkedIn
  • TwitThis

Comments are closed.