[Handel] subclassing Handel::Order in Catalyst

Christopher H. Laco claco at chrislaco.com
Fri Oct 20 16:59:33 CEST 2006


Ryan Lauterbach wrote:
> Christopher H. Laco wrote:
>> Ryan Lauterbach wrote:
>>   
>>> Yaaaa, its working!
>>>     
> Ok maybe that was a bit premature, but its close now, really!
> 
> When i go to checkout, the orders.total and orders.tax fields aren't 
> updated.  The order_items table has the price and total fields updated 
> ok.  Now i can understand the tax being empty as I haven't set this 
> anywhere.  What is the preferred method for doing this.  I read 
> something about default_values->() somewhere but is that what I should 
> be using?   I was thinking I needed to load a plugin (like I did with 
> AssignOrderNumber) to update orders.total but I figured that wouldn't be 
> the case.  At what point in the pipeline (CHECKOUT_PHASE_FINALIZE) would 
> these values be set?   Maybe there is an error with my subclassing below?
> 
> Thanks for any hints!

Define "when I go to checkout"... for the first time?
After updated the cart, and returning? The the bill/ship info? To the
payment info?

There are a few ways to go about the order totals...it depends on when
you expect it to be set and when.

I would think that the order.total field will always be empty until
after tax, shipping, etc is  calculated...but before any
authorization...so the FINALIZE phase would be too late...

The short answer is, you can do it whenever you want...
You could tweak the billing() Controller method to cal totals on post...

Or, you could add a checkout plugin for the VALIDATE phase and cal
totals in there...(which is run during the bill to/ship to updates...

Or, you could add a phase between VALIDATE and AUTHORIZE, and add a
plugin in there...

It's up to you really...just a bunch of building blocks...

-=Chris

-------------- 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/20061020/77e57e1b/attachment.pgp 


More information about the Handel mailing list