Difference between revisions of "Functions:orderGetSummary"

From Whirlwind eCommerce Wiki
Jump to: navigation, search
(New page: == Description == Retrieves summary order information. Useful for perpetual shopping carts. == Syntax == $orderArr = eV::orderGetSummary([INT $orderId]); == Paramaters == *orderId INTEGE...)
 
Line 20: Line 20:
 
     [completeDate] => DATETIME
 
     [completeDate] => DATETIME
 
     [cancelDate] => DATETIME
 
     [cancelDate] => DATETIME
     [itemTotal] =>  
+
     [itemTotal] => DECIMAL
 +
    [itemSurchargeTotal] => DECIMAL
 +
    [totalQuantity] => INT
 +
    [taxTotal] => DECIMAL
 +
    [shipTotal] => DECIMAL
 +
    [paymentTotal] => DECIMAL
 +
    [discountTotal] => DECIMAL
 +
    [totalItemCost] => DECIMAL
 +
    [totalOrderCost] => DECIMAL
 +
    [totalDue] => DECIMAL
 
)
 
)
 
</pre>
 
</pre>
Line 27: Line 36:
 
{|border=2
 
{|border=2
 
|-
 
|-
 +
|Element
 +
|Description
 +
|Example
 +
|-
 +
|orderNumber
 +
|INT order number for this order. This is a unique ID, but is nonsequential. Not to be confused with the orderId which is the sequential uniqueId. This orderNumber is what is presented to web site visitors referencing the orders to alleviate random attempts to access orders.
 +
|6912834
 +
|-
 +
|completeDate
 +
|DATETIME string date time of if/when the order was completed (processed). This will be empty while it is still an active shopping cart that has not been purchased.
 +
|2008-06-22 19:04:57
 +
|-
 +
|cancelDate
 +
|DATETIME string date time of if/when the order was canceled. This will be empty if the order has not been canceled.
 +
|2008-06-22 23:22:08
 +
|-
 +
|itemTotal
 +
|DECIMAL dollar value of summed up quantities x price per item. The total value of the products in the shopping cart not including shipping, taxes or discounts.
 +
|150.25
 +
|-
 +
|itemSurchargeTotal
 +
|DECIMAL dollar value of summed up quantities x item shipping surcharges (as set at the product level)
 +
|25.45
 +
|-
 +
|totalQuantity
 +
|INTEGER summed up item quantities in the order. For example if there are three different items in the cart, the first two have a quantity of 1 and the third has a quantity of 5, the totalQuantity will be 7.
 +
|7
 +
|-
 +
|taxTotal
 +
|DECIMAL total taxes charged to this order
 +
|24.67
 +
|-
 +
|shipTotal
 +
|DECIMAL total shipping charges to this order
 +
|12.54
 +
|-
 +
|paymentTotal
 +
|DECIMAL total of all processed payments attributed to this order
 +
|205.65
 +
|-
 +
|discountTotal
 +
|DECIMAL total of all discount code dollar values attributed to this order
 +
|25.12
 +
|-
 +
|totalItemCost
 +
|DECIMAL sum of itemTotal (quantity x per item price) + itemSurchargeTotal (shipping surcharges at the item level)
 +
|34.26
 +
|-
 +
|totalOrderCost
 +
|DECIMAL sum of all costs effecting this order - this is the order grand total (totalItemCost +taxTotal + shipTotal - discountTotal)
 +
|175.86
 +
|-
 +
|totalDue
 +
|DECIMAL outstanding amount due on this order (totalOrderCost - paymentTotal)
 +
|50.67
 +
|}
  
 
== Examples ==
 
== Examples ==
;example 1
+
<source lang="php">
example 1 goes here
+
// get the cart summary data
;example 2
+
$orderArr = eV::orderGetSummary();
example 2 goes here
+
  
== See Also ==
+
// output some of the results
:*[[tag:1|tag 1]]
+
echo "YOUR SHOPPING CART
:*[[tag:2|tag 2]]
+
<hr>
:*[[tag:3|tag 3]]
+
Total Number of Items:" . $orderArr['totalQuantity'] . "<br>
 +
Total Value:" . $orderArr['totalOrderCost'];
 +
</source>

Revision as of 06:29, 3 October 2008

Description

Retrieves summary order information. Useful for perpetual shopping carts.

Syntax

$orderArr = eV::orderGetSummary([INT $orderId]);

Paramaters

  • orderId INTEGER (optional)
unique order key of order information to retrieve. Defaults to the current sessions shopping cart's orderId.

Return Values

Returns associative array of summary order information. Return array is as follows:


Array
(
    [orderNumber] => INT
    [completeDate] => DATETIME
    [cancelDate] => DATETIME
    [itemTotal] => DECIMAL
    [itemSurchargeTotal] => DECIMAL
    [totalQuantity] => INT
    [taxTotal] => DECIMAL
    [shipTotal] => DECIMAL
    [paymentTotal] => DECIMAL
    [discountTotal] => DECIMAL
    [totalItemCost] => DECIMAL
    [totalOrderCost] => DECIMAL
    [totalDue] => DECIMAL
)

Element details from the returned array are as follows:

Element Description Example
orderNumber INT order number for this order. This is a unique ID, but is nonsequential. Not to be confused with the orderId which is the sequential uniqueId. This orderNumber is what is presented to web site visitors referencing the orders to alleviate random attempts to access orders. 6912834
completeDate DATETIME string date time of if/when the order was completed (processed). This will be empty while it is still an active shopping cart that has not been purchased. 2008-06-22 19:04:57
cancelDate DATETIME string date time of if/when the order was canceled. This will be empty if the order has not been canceled. 2008-06-22 23:22:08
itemTotal DECIMAL dollar value of summed up quantities x price per item. The total value of the products in the shopping cart not including shipping, taxes or discounts. 150.25
itemSurchargeTotal DECIMAL dollar value of summed up quantities x item shipping surcharges (as set at the product level) 25.45
totalQuantity INTEGER summed up item quantities in the order. For example if there are three different items in the cart, the first two have a quantity of 1 and the third has a quantity of 5, the totalQuantity will be 7. 7
taxTotal DECIMAL total taxes charged to this order 24.67
shipTotal DECIMAL total shipping charges to this order 12.54
paymentTotal DECIMAL total of all processed payments attributed to this order 205.65
discountTotal DECIMAL total of all discount code dollar values attributed to this order 25.12
totalItemCost DECIMAL sum of itemTotal (quantity x per item price) + itemSurchargeTotal (shipping surcharges at the item level) 34.26
totalOrderCost DECIMAL sum of all costs effecting this order - this is the order grand total (totalItemCost +taxTotal + shipTotal - discountTotal) 175.86
totalDue DECIMAL outstanding amount due on this order (totalOrderCost - paymentTotal) 50.67

Examples

// get the cart summary data
$orderArr = eV::orderGetSummary();
 
// output some of the results
echo "YOUR SHOPPING CART
<hr>
Total Number of Items:" . $orderArr['totalQuantity'] . "<br>
Total Value:" . $orderArr['totalOrderCost'];