Quote from: ProWebscape at Jun 30, 2008, 08:01 PM
I agree with you that there should be some additional events, especially onBeforeShip, onShipComplete.
...
I was thinking onAddtoBasket is adding the products to the basket from the product page. And onRemovefromCart, onUpdateCart would be looking at the actual cart/checkout page. (onAddtoCart is probably not necessary).
An event based e-commerce system that totally ignores the catalog (how counterintuitive!) with some basic "modules" implemented would be super-yummy the more I think of it ...
I’d nuke the "basket" stuff personally, and just stick with a simpler and probably standard terminology. The following is a revised event/function list in progress, with descriptions and rough order of where they’d fall. Probably a bit overkill in spots and totally lacking in others, but just a quick brain dump:
[*] createCart - session or DB with expiration flag; could also be used for wishlists, wedding/baby registries, etc.
[*] onAddtoCart - putting something in your cart/basket, from the catalog
[*] onRemovefromCart - removing line items from the cart itself
[*] onUpdateCart - updating line items from the cart itself
[*] getCartLine - reference individual cart line items
[*] modifyCartLine - modify individual cart line items; useful for applying per-line qty discounts, trap for alternate shipping handling (e.g., drop shipped items), etc.
[*] calculateOrderSize - where total weight, price and piece count is calculated; could be used to calculate qty or dollar volume discounts, etc.; also for shipping estimates based on total shipping weight
[*] getShippingMethods - available shipping methods (per line item, taking inventory availability into account?)
[*] getShipping - determines shipping cost based on weight and shipping method
[*] onStartCheckout - moving from the cart/catalog into the checkout process; could be used to switch payment options based on customer type (wholesale vs. retail) or trap the cart to send to alternate checkout flows
[*] onBeforeCalculateOrderTotal - could apply coupons at this point, or calculate quantity/dollar based on iterating through each item via getCartLine (yes this provides multiple points to check for modifying cart line items, and multiple ways to handle discounting and promotions ... pick what works best for you)
[*] calculateTax - calls getCartLine to determine if tax applies to each line
[*] calculateTotalPrice - sums all product, shipping, handling, tax and any other items inserted at onStartCheckout or onBeforeCalculateOrderTotal
[*] onBeforePayment - trap for previous payment errors (e.g., offer to use a different card based on error codes) or insert other logic here
[*] onPaymentComplete - when payment or authorization processes finishes; could post to accounting system here
[*] onBeforeShip - event provided to modify shipping parameters based on logic and calling each getCartLine to determine costs based on logic (e.g. takes special shipping per line item into account); also could do rate shopping here, or splitting back-ordered items off to new orders
[*] shipItem - when item is paid for and optionally logged to the shipping system (could do the capture part of authorize and capture here)
[*] onShipComplete - immediately after shipping, includes tracking information; could post to accounting system here, too if it suits our business better