Difference between revisions of "Functions:addressesGet"

From Whirlwind eCommerce Wiki
Jump to: navigation, search
(New page: == Description == eV::addressesGet returns an array of addresses from both the selected user account and order. For use with offering an address selection for multiple shipping address che...)
 
Line 7: Line 7:
 
== Paramaters ==
 
== Paramaters ==
 
*addressList STRING OPTIONAL
 
*addressList STRING OPTIONAL
:: comma-delimited list of address fields. user_addressId and sale_addressId will automatically be included. Available address fields:
+
:: comma-delimited list of address fields. user_addressId and order_addressId will automatically be included. Available address fields:
 
::*addressName
 
::*addressName
 
::*firstName
 
::*firstName
Line 39: Line 39:
 
             // always returned
 
             // always returned
 
             [user_addressId] => INT
 
             [user_addressId] => INT
             [sale_addressId] => INT
+
             [order_addressId] => INT
 
             // optional elements, as specified in $fieldList
 
             // optional elements, as specified in $fieldList
 
             [addressName] => STRING
 
             [addressName] => STRING

Revision as of 03:17, 25 May 2009

Description

eV::addressesGet returns an array of addresses from both the selected user account and order. For use with offering an address selection for multiple shipping address checkouts.

Syntax

$array = eV::addressesGet([$addressList][,$orderArray][,$userId]);

Paramaters

  • addressList STRING OPTIONAL
comma-delimited list of address fields. user_addressId and order_addressId will automatically be included. Available address fields:
  • addressName
  • firstName
  • lastName
  • street1
  • street2
  • city
  • state
  • zipCode
  • country
  • phone1
  • phone2
  • phone3
  • fax
  • title
  • company
  • orderArray ARRAY OPTIONAL
Array of order information for order addresses to be returned, as provided by eV::orderGetCompleteArray()
  • userId INT OPTIONAL
unique userId for user's addresses to be returned

Return Values

Multidimensional array with first dimension being the numerical index of the address, second index containing the address field name.

The returned array is as follows (only requested fields via $fieldList will be returned):

Array
(
    [0] => Array
        (
            // always returned
            [user_addressId] => INT
            [order_addressId] => INT
            // optional elements, as specified in $fieldList
            [addressName] => STRING
            [firstName] => STRING
            [lastName] => STRING
            [street1] => STRING
            [street2] => STRING
            [city] => STRING
            [state] => STRING
            [zipCode] => STRING
            [country] => STRING
            [phone1] => STRING
            [phone2] => STRING
            [phone3] => STRING
            [fax] => STRING
            [company] => STRING
            [title] => STRING
        )
    [1] => Array ...
)

Examples

Basic use example
// get current order, users addresses
$arrAddresses = eV::getAddresses('addressName,firstName,lastName');
// output
foreach($arrAddresses as $address) echo "<br>" . $address['addressName'] . ": " . $address['firstName'] . " " . $address['lastName'];
Example with previously called eV
:orderGetCompleteArray
// get order
$orderArray = eV::orderGetCompleteArray();
// get current order, users addresses
// reuse the orderArray so script uses less overhead
$arrAddresses = eV::getAddresses('addressName,firstName,lastName',$orderArray);
// output
foreach($arrAddresses as $address) echo "<br>" . $address['addressName'] . ": " . $address['firstName'] . " " . $address['lastName'];