I am wondering what method is best.

heres a very basic description in  psuedo code for component i am working
on

the component is passed args which detail which address, payment etc is to
be retrieved from a customers details and then inserts it into the orders
db

<component addorder>

function submitorder{

invoke initorder - returns newordernumber

invoke getcustaddress - returns addressid

invoke getcustpayment - returns paymantid

invoke flushtodb - returns true or false

return
}

function initorder{
creates neworder
}

function getcustaddress{
retrieves cust address and inserts into orderaddress
returns orderaddressid
}

function getcustpayment{
retrieves cust payment and inserts into orderpayment
returns orderpaymentid
}

function flushtodb {
inserts orderaddressid and orderpaymentid into ordersmain table
where ordernum = newordernum

</component>


what i now need is for an email to be sent to the cust detailing their
order. Instead of doing another load of db queries to find the information
of their order, am i right in saying that if i was to add a new function
called initvars which would create empty variables to be filled by the
current functions and then invoke it within submitorder (before current
functions are invoked), the empty variables can then be 'filled' by the
functions already inplace. Something like this

function initvars {
this.ordernumber = ""
this.orderaddress1 = ""
this.orderaddress2 = ""
}

then when each function is invoked they would do this

function getcustaddress{
retrieves cust address and inserts into orderaddress
set this.orderaddress1 = #getcustaddress.address1#
set this.orderaddress2 = #getcustaddress.address1#
returns orderaddressid
}

A final function would then be invoked from submitorder and send an email

function sendmail{
<cfmail...>
Your order will be sent to:
#this.orderaddress1#
#this.orderaddress2#
</cfmail>
}

If i was to use this method then is this correct. Can ireference the
variables from the initvars function and then set them new values within
the the functions and then reference them in the final function send mail
or is this the totally wrong way?

also  is the this.variable name correct for this type of thing.

cheers in advance

Jamo



---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to