I have a totally separate system for actually calculating shipping by
zone, perc, weight, etc..
What I'm talkin' about here would be actually adding the shipping amount
in memory. Right now I've got it like this:
<cfinvoke component="#APPLICATION.checkout#" method="addUPSShipping"
Then in checkout.cfc it looks like this:
<cfcomponent>
<!--- create struct --->
<cfset VARIABLES.shippinginfo = StructNew()>
<!--- Debug methods --->
<cffunction name="dumpcheckoutshipping" hint="Dumps the checkout
shipping struct" returntype="struct" output="false">
<cfreturn VARIABLES.shippinginfo>
</cffunction>
<!--- ADD SHIPPING AMOUNT VIA UPS RATES METHOD --->
<cffunction name="addUPSShipping" hint="Adds UPS shipping amount"
returntype="struct" output="false">
<cfargument name="UPSShippingInfo" type="string" required="yes">
<cfargument name="shippername" type="string" required="yes">
<cfset var shipmethod = "">
<cfset var shipaamount = "">
<cfset shipmethod = ListFirst(ARGUMENTS.UPSShippingInfo, "_")>
<cfset shipamount = Listlast(ARGUMENTS.UPSShippingInfo, "_")>
<cfset VARIABLES.shippinginfo.shipmethod = shipmethod>
<cfset VARIABLES.shippinginfo.shipmamount = shipamount>
<cfset VARIABLES.shippinginfo.shippername = ARGUMENTS.shippername>
<cfreturn variables.shippinginfo>
</cffunction>
I also have methods like getFinalCartTotal() and such in checkout.cfc.
I feel like I'm coding blind here. :)
Thanks,
Will
Rob Munn wrote:
I think your shippingcalculator.cfc should probably be a singleton. You
should not need to have more than one instance of the object in memory- all
you are doing is running a cart through it and returning shipping costs,
right?
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Will Tomlinson
Sent: Saturday, February 25, 2006 10:53 AM
To: CFCDev@cfczone.org
Subject: Re: [CFCDev] cart objects
I dunno dude. It sounds good, but is kinda over my head right now. :)
Thanks much,
Will
Baz wrote:
Hey Will,
I would guess that the shippingcalculator.cfc should be passed into the
checkout.cfc at init(). That way you can easily re-use it in other
places (which is common for a shipping calculator). You would also
probably want to pass in the cart object so you can use the data stored
in it for the checkout. Other than that you would have the checkout cfc
perform the checkout functions specific to your app (add order, notify
someone, update some setting, etc...)
What do u think?
Baz
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Will Tomlinson
Sent: Saturday, February 25, 2006 6:50 AM
To: CFCDev@cfczone.org
Subject: [CFCDev] cart objects
Hey,
I'm having some trouble grasping what methods belong where in my cart
application.
cart.cfc has the usual suspects:
add()
update()
remove()
showCart()
getCartSubTotal()
getCartProdCount()
getShipWeight()
etc...
I also have a checkout.cfc, but what goes in it exactly? I had built a
shipping calculator.cfc that adds shipping but I'm guessing that needs
to go in checkout.cfc instead?
addShipping()
addPaymentType()
??
Thanks,
Will
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
An archive of the CFCDev list is available at
www.mail-archive.com/cfcdev@cfczone.org