[Handel] plugin for checkout
Christopher H. Laco
claco at chrislaco.com
Sat Aug 12 22:42:48 CEST 2006
Jan Gerene wrote:
> 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 > 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,
>
>
We resolved this on IRC, but for the sake of the answer being here....
Handel::Checkout loads plugins from Handel::Checkout::Plugin::*.
To load plugins from different namespaces, you must add them to the ENV
config variables, or during new:
my $checkout addpluginpaths => 'UniBooks::Plugin',
order => $order,
phases => 'CHECKOUT_PHASE_VALIDATE'
});
-=Chis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/handel/attachments/20060812/f7197f16/attachment.pgp
More information about the Handel
mailing list