[Handel] plugin for checkout
Jan Gerene
jan at gerene.be
Sat Aug 12 16:03:26 CEST 2006
Hi,
I wrote a small plugin for checkout:
package UniBooks::Plugin::AddTax;
use Handel::Constants qw(:checkout);
use base 'Handel::Checkout::Plugin';
sub register {
my ($self, $ctx) = @_;
$ctx->add_handler(CHECKOUT_PHASE_VALIDATE, \&add_tax);
};
sub add_tax {
my ($self, $ctx) = @_;
$ctx->log->debug("adding tax");
$ctx->order->tax(20);
return CHECKOUT_HANDLER_OK;
};
1;
which I would like to use in the validate phase of checkout.
I thought that when I put "use UniBooks::Plugin::AddTax;" in
UniBooks/Controller/Checkout.pm, the following would call that plugin:
my $checkout = Handel::Checkout->new({
order => $order,
phases => 'CHECKOUT_PHASE_VALIDATE'
});
if ($checkout->process == CHECKOUT_STATUS_OK) {
}
But this does not happen. What am I missing to register this plugin?
Thanks,
--
Jan Gerené
Heikant 99
2560 Bevel
tel. +32-32971252
gsm. +32-475-406294
More information about the Handel
mailing list