XactCommerce Xact Objects
Home
News
XactCommerce
Typical Applications
Custom Development
Private Backend
XactScript Language
Performance
Deployment
Partners
Portfolio
About Us
leXml Language < Interface Modules & Commands < If_Order

If_Order
Interface module for dealing with orders, shopping carts, etc.

getorderrecord
Returns the order record as either an apprecord or an orderrecord


getposthandler
This gets a CardProcessingHandler object instance for this order. Returns null if there is a problem.


load
This command loads an existing order, returning 'yes' or 'no' depending on whether the order was loaded.
 
Required arguments:
ord_id - Order ID of order to load
 
Optional arguments:
isReleaseOrder - yes if order is a release order (default=no)
 
Returns 'ok' or 'error:...'


loadorcreatefromsession
This command loads the current order or cart from the value of 'ord_id' in the session, or creates an order if none exists. This is used mostly to simplify shopping cart pages.
 
Arguments:
owner_id - Owner ID of order (required)
createascart - Create orders with shopping cart mode on? (default=true)
create - Create order if it doesn't exist? (default=true)
isBlanketOrder - yes if order is a blanket order (default=no)
isReleaseOrder - yes if order is a release order (default=no)
realeaseWithoutOriginatingOrder - yes if release can occur without authorization (default=no)
ord_id - Order ID of order to load
session_name = extra text to pull order out of session with (optional) this can be used to store multiple kinds of orders in the session
 
Returns 'new' or 'old' depending on whether a new order was created or an existing one was loaded. Returns 'error:...' if an unrecoverable error occurs or if create is false and no order existed.


create
Called to create a new order (order is not actually created until commit is called!)
 
Required arguments:
owner_id - Owner ID of new order
 
Optional arguments:
isReleaseOrder - yes if order is a release order (default=no)
 
Returns 'ok' or 'error:...'


commit
This command commits the currently loaded record, returning the record ID if commit was successful or a message beginning with 'error:' if the commit was not successful.


assignrefid
This command assigns the current order an ord_refid. Does nothing if it already has one.
 
Returns and prints the new ord_refid.
 
Optional Arguments:
'defreleases' - Number of Releases if cli_defrealeses (default releases) not found in owner (default = 0)


additem
'additem' adds an item to the order's line, adding all sub kit items if necessary.
 
Arguments are:
item - Either item ID or an item AppRecord object from another interface module (required)
taxable - True or False (case insensitive) (default = true)
pricelevel - Price level (default = 0 if not present)
quantity - Number of items to add (default = 1)
name - Item Name to use (default = item name from item record)
desc - Item Description to use (default = item name from item record)
shdesc - Item Short Description to use (default = blank)
refno - Item Referreal Number (default = blank)
defreleases - Number of Releases if cli_defrealeses (default releases) not found in owner (default = 0)
sortbyfield - Sort-by field to set in line (default=null)
 
Returns the new line id or 'error: ...' if an error occurs.


deleteshippingitems
This deletes shipping items from the line


dropship
This dropships an order
 
Arguments:
ship_emp_id - Employee record ID of shipping address
 
Returns 'ok' or 'error:...'


getlineid
This returns the line ID corresponding to a particular item or 0 if there is no line for this item. If there is more than one line entry with this item, the first will be returned.
 
Arguments:
item_id - Item ID to search for; required


updatelinedesc
Updates the description for a line
 
Arguments:
line_id - Line to update (required)
desc - New description (required)
 
Returns 'ok' or 'error:...'


updatelinequantity
Updates the quantity for a line
 
Arguments:
line_id - Line to update (required)
quantity - New quantity (required)
 
Returns 'ok' or 'error:...'


updatelineprice
Updates the price for a line
 
Arguments:
line_id - Line to update (required)
price - New price (required)
 
Returns 'ok' or 'error:...'


clearline
This clears the line for an order


deleteline
Deletes a line and optionally it's children
 
Arguments
line_id - Line record ID to delete (required)
deletesublines - true/false - Delete sub-lines (default=true)
Returns 'yes' or 'no' depending on whether delete was successful.


deletelinebydesc
Deletes a line and optionally it's children
Arguments:
line_desc - Line desc to delete (required)
Returns 'yes' or 'no' depending on whether delete was successful.


templatelinelist
This command outputs the line according to a template as given below:
 
##LINEID## - Line ID of this line
##ITEMID## - Item ID of the current item on this line
##QTY## - Quantity of items ordered
##PRICE## - Price of item on line
##EXTPRICE## - Price of item * quantity ordered
##COST## - Cost of item on line
##EXTCOST## - Cost of item * quantity ordered
##NAME## - Name of item on line
##DESC## - Description of item on line
##SHDESC## - Short Description of item on line
##INDENT## - Replaced with a series of indents corresponding to the depth
##TAXABLE## - Taxable? (either 'yes' or 'no')
##SID## - Session ID
##SIDHF## - Session ID as hidden field
##INVTYPE## - Item inventory type
##CR## - A carriage return (this is there for doing e-mails)
##CLINAME## - Client Name (if present)
##REFNO## - Line Refno (line_refno)
##SORTBY## - User-settable line sort-by field
 
Arguments:
template - Template string (required)
indent - String to replace ##INDENT## with (default='  ')
hidefield - hide all lines when this column name is set to hidevalue (optional)
hidevalue - hide all lines when hidefield column is set to this value (optional)
hidecompare - used to hide lines where field compares to value (equals, equalsIgnoreCase, lessthan, greaterthan, notequals, equalsIgnoreCase)
useasciitable - (true/false) - whether to output results in an ascii table default = false
tablespec - ColumnType/Prefix/Postfix/Width/Attr see AsciiTable spec
pagewidth - number of characters wide the AsciiTable should be
 
For totals use the 'total' command after listing the line. It's your responsibility to construct your own table or however else you'd like to display this.
 
Returns 'ok' or 'error:...'


getrefid
Returns and prints the order reference ID (ord_refid)


getnotes
Returns and prints the order text notes (ord_notes)


getexpdate
Returns and prints the order expect date (ord_exp_date)


getpromiseddate
Returns and prints the order promised date (ord_promiseddate)


getopenclosed
Returns and prints the order openclosed status (ord_openclosed)


getrefno
Returns and prints the order ref number (ord_refno)


getdebugmsg
Returns and prints the order debug message


getempid
Returns and prints the order emp_id


getsalespersonid
Returns and prints the order salesperson_id


getfname
Returns and prints the order emp_fname


getlname
Returns and prints the order emp_lname


getcliid
Returns and prints the order emp_id


getownerid
Returns and prints the order owner_id


getesttotal
Returns and prints the estimated and actual total if already calculated


getacttotal
Returns and prints order actual total


getshipper
Returns and prints the shipping item id from the line


setnotes
Sets the order notes (text=notes...)


settest
Sets the order test (test=notes...)


setdatebehavior
Sets the date behavior of order lines
values include:
frisatsun_mon = if it's fri, sat or sun the date will reset to monday
satsun_mon = if it's sat or sun the date will reset to monday


setrefno
Sets the order ord_refno (refno)


setblanket
Sets the order as a blanket order


setclosed
Sets the order as closed


setexpdate
Sets the order expect date (from passed date value)


setpromiseddate
Sets the order promised date (from passed date value)


setopenclosed
Sets the order openclosed status (from passed openclosed value)


setrealeaseorder
Sets this order as a release order


setnonrealeaseorder
Sets this order as not a release order


setRealeaseWithoutOriginatingOrder
Sets this order behavior to allow releases without an original authorization line


setshipper
Sets the shipper for the order.
 
Arguments:
shp_item_id - Shipper item ID (required)
taxable - Should shipping be taxable? (default=true)
 
Returns the line ID or "error:..." if an error occurs.


getsesordid
Returns and prints the order ID in the session
 
Arguments:
owner_id - Owner ID of order (required)
session_name = extra text to pull order out of session with (optional) this can be used to store multiple kinds of orders in the session


getlineitemcount
Returns and prints the number of line items


countitems
This counts the quantity of a given item ID (or all items) in the line of this order.
 
Arguments:
item_id - Item ID to count


gettotal
This returns/prints the value of an already calculated order total
 
Arguments:
estimation - Use ORD_EST_TOTAL instead of ORD_ACT_TOTAL? (true/false) (default=false)


getcctype
Returns and prints the credit card type


calctotal
Recalculates order total in database, returning and printing new total. Returns/prints 'error:...' if an error occurs.
 
Arguments:
calconly - Do not update database (default=false)
estimation - Is this just an estimated total? (default=false)
includetax - Include tax? (default=true)
add - Amount to add onto end total? (default=0.00)


findtax
This causes the order to search for an applicable tax district. Returns 'yes' if an applicable district was found or 'no' otherwise.
 
Arguments:
tax_state - 2-letter state abbreviation of customer's shipping location


recalcshipping
Recalculates shipping and returns the new shipping cost or 'error:...'


calctax
Prints/returns the tax owed on an order


iscart
Returns 'yes' or 'no' depending on whether the order is a cart


isreleaseorder
Returns 'yes' or 'no' depending on whether the order is a release order


setcartstatus
Sets the iscart status to true/false depending on the value of the 'iscart' argument.


setordtype
Sets the ord_type to the value of the 'ordertype' argument.


setbillinginfo
This command sets the credit card or billing information.
 
Arguments:
cardtype - Credit card type or 'Check' for a check order (required)
cardnumber - Credit card number (default=none)
cardexpmonth - Card expiration month (default=0)
cardexpyear - Card expiration year (full 4-digit year) (default=0)
 
Returns 'ok' or 'error:...'


setclientowner
This command sets the record client owner
 
Required arguments:
clientowner - Can be either a client ID or a client record passed from another module
Returns 'ok' or 'error:...' depending on whether this was successful.


setemployeeowner
This command sets the record employee owner
 
Required arguments:
employeeowner - Can be either an employee ID or an employee record passed from another module
 
Returns 'ok' or 'error:...' depending on whether this was successful.


setsalesperson
This command sets the record salesperson
 
Required arguments:
salesperson - Can be either an employee ID or an employee record passed from another module
 
Returns 'ok' or 'error:...' depending on whether this was successful.


zaporder
Clears the order_id from the session
 
Arguments:
owner_id - Owner ID of order (required)
session_name = extra text to pull order out of session with (optional) this can be used to store multiple kinds of orders in the session