Documentation

GetList

CDBResult
CSaleOrderPropsValue::GetList(
 string &by,
 string &order,
 array arFilter = Array()
);

The method GetList returns an optionally sorted and filtered list of order property values.

Parameters

ParameterDescription
by Specifies the name of a parameter by which the sorting is to be performed. 

The following values are possible:
  • VALUE - value (default);
  • ORDER_ID - the order ID;
  • NAME - property name;
  • CODE - property mnemonic code.
order Sort order. Can be one of the following:
  • ASC - ascending;
  • DESC - descending.
arFilter The filter is an associated array whose keys are the parameter names, and values are the conditions.

The following keys are possible:
  • ORDER_ID - the order ID;
  • ORDER_PROPS_ID - the order property ID;
  • CODE - order property mnemonic code.

Return Values

Returns an instance of CDBResult, containing a set of associated arrays with the following keys.

Key Description
ID The order property value ID.
ORDER_ID The order ID.
ORDER_PROPS_ID The order property ID.
NAME The order property name.
VALUE Order property value.
CODE Property mnemonic code.

Example


<?
// Obtain the customer name 
// (value provided in the $ORDER_ID 
//  order property field with IS_PAYER flag set)
$PAYER_NAME = "";
$db_order = CSaleOrder::GetList(Array("DATE_UPDATE"=>"DESC"), 
                                Array("ID" => $ORDER_ID));
if ($arOrder = $db_order->Fetch())
{
   $db_props = CSaleOrderProps::GetList(($by="SORT"), 
                                        ($order="ASC"), 
                                        Array("PERSON_TYPE_ID" =>
                                                  $arOrder["PERSON_TYPE_ID"], 
                                              "IS_PAYER"=>"Y"));
   if ($arProps = $db_props->Fetch())
   {
      $db_vals = CSaleOrderPropsValue::GetList(($by="SORT"), 
                                               ($order="ASC"), 
                                               Array("ORDER_ID" => $ORDER_ID, 
                                                     "ORDER_PROPS_ID" => 
                                                         $arProps["ID"]));
      if ($arVals = $db_vals->Fetch())
          $PAYER_NAME = $arVals["VALUE"];
   }
}
echo $PAYER_NAME;
?>
© «Bitrix24», 2001-2024
Up