Add
bool CPrice::Add( array arFields );
The method Add adds a new price to a product.
Parameters
Parameter | Description |
---|---|
arFields | Associated array of the price parameters with the following keys.
|
Return Values
Returns True on success or False otherwise.
Example
<? // Assign the price of USD29.95 of the type 2 // to the product with the ID of 15 $PRODUCT_ID = 15; $PRICE_TYPE_ID = 2; $arFields = Array( "PRODUCT_ID" => $PRODUCT_ID, "CATALOG_GROUP_ID" => $PRICE_TYPE_ID, "PRICE" => 29.95, "CURRENCY" => "USD" ); $res = CPrice::GetList(($o=""), ($b=""), Array("PRODUCT_ID"=>$PRODUCT_ID, "CATALOG_GROUP_ID"=>$PRICE_TYPE_ID)); if ($arr = $res->Fetch()) { CPrice::Update($arr["ID"], $arFields); } else { CPrice::Add($arFields); } ?>
© «Bitrix24», 2001-2024