GetByID
array CPrice::GetByID( int ID );
The method GetByID returns the description array of the specified price .
Parameters
Parameter | Description |
---|---|
ID | Price ID. |
Return Values
Associated array with the following keys.
Key | Description |
---|---|
ID | Price ID. |
PRODUCT_ID | Product ID. |
EXTRA_ID | The ID of the applicable discount (or extra). |
CATALOG_GROUP_ID | Price type ID. |
PRICE | Price value. |
CURRENCY | Currency of the price. |
CAN_ACCESS | If "Y", the current user is allowed to view prices of this type. If "N", prices of this type should be hidden. |
CAN_BUY | If "Y", the current user is allowed to purchase at prices of this type. Otherwise "N". |
CATALOG_GROUP_NAME | Name of the price type in the current language. |
Example
<? $ID = 11; $arPrice = CPrice::GetByID($ID); echo "Price of type ".$arPrice["CATALOG_GROUP_NAME"]. " for the product #".$ID.": "; echo CurrencyFormat($arPrice["PRICE"], $arPrice["CURRENCY"])."<br>"; echo "You are ".(($arPrice["CAN_ACCESS"]=="Y") ? "allowed" : "not allowed")." to view this price."; ?>
© «Bitrix24», 2001-2024