GetList
CDBResult CSaleOrderPropsVariant::GetList( string &by, string &order, array arFilter = Array() );
The method GetList returns an optionally sorted and filtered list of order property value variants.
Parameters
Parameter | Description |
---|---|
by | Specifies the name of a parameter by which the sorting is to be
performed. The following values are possible:
|
order | Sort order. Can be one of the following:
|
arFilter | The filter is an associated array whose keys are the parameter names,
and values are the conditions. The following keys are possible:
|
Return Values
Returns an instance of CDBResult, containing a set of associated arrays with the following keys.
Key | Description |
---|---|
ID | The ID of the order property variant. |
ORDER_PROPS_ID | The order property ID. |
NAME | Variant name. |
VALUE | Variant value. |
SORT | Variant sort weight. |
DESCRIPTION | Variant description as it is displayed to a visitor. |
Example
<? // Display a form for inputting order properties for property group with ID=5 // which are in the customer profile. Use the payer type ID=2 $db_props = CSaleOrderProps::GetList(($by="SORT"), ($order="ASC"), Array("PERSON_TYPE_ID"=>2, "PROPS_GROUP_ID"=>5, "USER_PROPS"=>"Y")); if ($props = $db_props->Fetch()) { echo "Please fill in the order properties:<br>"; do { echo $props["NAME"]; if ($props["REQUIED"]=="Y" || $props["IS_EMAIL"]=="Y" || $props["IS_PROFILE_NAME"]=="Y" || $props["IS_LOCATION"]=="Y" || $props["IS_LOCATION4TAX"]=="Y" || $props["IS_PAYER"]=="Y") { echo "*"; } echo ": "; if ($props["TYPE"]=="CHECKBOX") { echo '<input type="checkbox" class="inputcheckbox" name="ORDER_PROP_'.$props["ID"]. '" value="Y"'. (($props["DEFAULT_VALUE"]=="Y")?" checked":"").'>'; } elseif ($props["TYPE"]=="TEXT") { echo '<input type="text" class="inputtext" size="'.((IntVal($props["SIZE1"])>0)?$props["SIZE1"]:30). '" maxlength="250" value="'. htmlspecialchars($props["DEFAULT_VALUE"]). '" name="ORDER_PROP_'.$props["ID"].'">"; } elseif ($props["TYPE"]=="SELECT") { echo '<select name="ORDER_PROP_'.$props["ID"]. '" size="'. ((IntVal($props["SIZE1"])>0)?$props["SIZE1"]:1).'">'; $db_vars = CSaleOrderPropsVariant::GetList(($by="SORT"), ($order="ASC"), Array("ORDER_PROPS_ID"=>$props["ID"])); while ($vars = $db_vars->Fetch()) { echo '<option value="'.$vars["VALUE"].'"'. (($vars["VALUE"]==$props["DEFAULT_VALUE"])?" selected":""). '>'.htmlspecialchars($vars["NAME"]).'</option>'; } echo '</select>'; } elseif ($props["TYPE"]=="MULTISELECT") { echo '<select multiple name="ORDER_PROP_'. $props["ID"].'[]" size="'. ((IntVal($props["SIZE1"])>0)?$props["SIZE1"]:5).'">'; $arDefVal = Split(",", $props["DEFAULT_VALUE"]); for ($i = 0; $i<count($arDefVal); $i++) $arDefVal[$i] = Trim($arDefVal[$i]); $db_vars = CSaleOrderPropsVariant::GetList(($by="SORT"), ($order="ASC"), Array("ORDER_PROPS_ID"=>$props["ID"])); while ($vars = $db_vars->Fetch()) { echo '<option value="'.$vars["VALUE"].'"'. (in_array($vars["VALUE"], $arDefVal)?" selected":""). '>'.htmlspecialchars($vars["NAME"]).'</option>'; } echo '</select>'; } elseif ($props["TYPE"]=="TEXTAREA") { echo '<textarea rows="'.((IntVal($props["SIZE2"])>0)?$props["SIZE2"]:4). '" cols="'.((IntVal($props["SIZE1"])>0)?$props["SIZE1"]:40). '" name="ORDER_PROP_'.$props["ID"].'">'. htmlspecialchars($props["DEFAULT_VALUE"]).'</textarea>'; } elseif ($props["TYPE"]=="LOCATION") { echo '<select name="ORDER_PROP_'.$props["ID"].'" size="'. ((IntVal($props["SIZE1"])>0)?$props["SIZE1"]:1).'">'; $db_vars = CSaleLocation::GetList(Array("SORT"=>"ASC", "COUNTRY_NAME_LANG"=>"ASC", "CITY_NAME_LANG"=>"ASC"), array(), LANGUAGE_ID); while ($vars = $db_vars->Fetch()) { echo '<option value="'.$vars["ID"].'"". ((IntVal($vars["ID"])== IntVal($props["DEFAULT_VALUE"]))?" selected":""). '>'.htmlspecialchars($vars["COUNTRY_NAME"]. " - ".$vars["CITY_NAME"]).'</option>'; } echo '</select>'; } elseif ($props["TYPE"]=="RADIO") { $db_vars = CSaleOrderPropsVariant::GetList(($by="SORT"), ($order="ASC"), Array("ORDER_PROPS_ID"=>$props["ID"])); while ($vars = $db_vars->Fetch()) { echo '<input type="radio" name="ORDER_PROP_'.$props["ID"]. '" value="'.$vars["VALUE"].'"'. (($vars["VALUE"]==$props["DEFAULT_VALUE"])?" checked":""). '>'.htmlspecialchars($vars["NAME"]).'<br>'; } } if (strlen($props["DESCRIPTION"])>0) { echo "<br><small>".$props["DESCRIPTION"]."</small>"; } echo "<br>"; } while ($props = $db_props->Fetch()); } ?>
© «Bitrix24», 2001-2024