Hi
I need to add an extra action to the CheckoutPage_Controller class. I want to do this in a way that does not change any module code so that I can easily update the module at a later date.
I have been able to achieve this by adding my action method into the Page_Controller class which CheckoutPage_Controller inherits from, but this is a little messy for me as that action will now be available on all controllers that inherit from Page_Controller.
Is there a way to use the Decorator pattern to achieve the same thing. I have tried using the Extension class, and although I know the class is being hooked in (overrode the setOwner method to check) the new action Method is not allowed.
placed in mysite/_config.php
Object::add_extension('CheckoutPage_Controller','ExtendedCheckoutPage_Controller');
class ExtendedCheckoutPage_Controller extends Extension {
function LocalOrderForm() {
return new LocalOrderForm($this->owner, 'LocalOrderForm');
}
}
Anyone got any advice here?
Many thanks
Jason