Documentation

GetOrderProps

CDBResult
CSaleOrderPropsValue::GetOrderProps(
 int ORDER_ID
);

The method GetOrderProps returns a set of property values of a specified order. In addition, some bound values are returned as well.

Parameters

ParameterDescription
ORDER_ID The order ID.

Return Values

Returns an instance of CDBResult, containing a set of associated arrays with the keys describing the order property values. These and some additional keys are summarized in the table below.

The returned set is sorted consequently by: the order property group sort weight; the order property group name; order property sort index; the order property name.

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.
PROPERTY_NAME The order property name.
TYPE Order property type.
PROPS_GROUP_ID The order property group ID.
GROUP_NAME The order property group name.
IS_LOCATION Specifies the field value is to be used as a customer location when calculating the delivery price (Y/N).
IS_EMAIL Denotes the field value should be used as a customer's e-mail address (Y/N).
IS_PROFILE_NAME Denotes the field value should be used as a customer's profile name (Y/N).
IS_PAYER Denotes the field value should be used as a payer name (Y/N).

Example


<?
// Display all properties of an order $ID; group by property groups
$db_props = CSaleOrderPropsValue::GetOrderProps($ID);
$iGroup = -1;
while ($arProps = $db_props->Fetch())
{
   if ($iGroup!=IntVal($arProps["PROPS_GROUP_ID"]))
   {
      echo "<b>".$arProps["GROUP_NAME"]."</b><br>";
      $iGroup = IntVal($arProps["PROPS_GROUP_ID"]);
   }

   echo $arProps["NAME"].": ";

   if ($arProps["TYPE"]=="CHECKBOX")
   {
      if ($arProps["VALUE"]=="Y")
         echo "Yes";
      else
         echo "No";
   }
   elseif ($arProps["TYPE"]=="TEXT" || $arProps["TYPE"]=="TEXTAREA")
   {
      echo htmlspecialchars($arProps["VALUE"]);
   }
   elseif ($arProps["TYPE"]=="SELECT" || $arProps["TYPE"]=="RADIO")
   {
      $arVal = 
         CSaleOrderPropsVariant::GetByValue($arProps["ORDER_PROPS_ID"], 
                                            $arProps["VALUE"]);
      echo htmlspecialchars($arVal["NAME"]);
   }
   elseif ($arProps["TYPE"]=="MULTISELECT")
   {
      $curVal = split(",", $arProps["VALUE"]);
      for ($i = 0; $i<count($curVal); $i++)
      {
         $arVal = 
            CSaleOrderPropsVariant::GetByValue($arProps["ORDER_PROPS_ID"], 
                                               $curVal[$i]);
         if ($i>0) echo ", ";
         echo htmlspecialchars($arVal["NAME"]);
      }
   }
   elseif ($arProps["TYPE"]=="LOCATION")
   {
      $arVal = CSaleLocation::GetByID($arProps["VALUE"], LANGUAGE_ID);
      echo htmlspecialchars($arVal["COUNTRY_NAME"]." - ".
           $arVal["CITY_NAME"]);
   }

   echo "<br>";
}
?>
© «Bitrix24», 2001-2024
Up