Documentation

SetBasePrice

bool
CPrice::SetBasePrice(
 int ProductID, 
 float Price, 
 string Currency[,
 int|boolean quantityFrom = false[,
 int|boolean quantityTo = false[,
 boolean bGetID = false]]]
);

Method sets base price for product with ProductID. Non-static method. Before using this method, ensure that product characteristics were saved - class CCatalogProduct.

Important! It's recommended to use the method CPrice::Add instead.

Call parameters

ParameterDescriptionAvailable from version
ProductID Product or SKU ID (iblock item ID).

Before version 4.0.4 this parameter was named PRODUCT_ID.
Price New base price.

Before version 4.0.4 this parameter was named PRICE.
Currency New base price currency.

Before version 4.0.4 this parameter was named CURRENCY.
quantityFrom starting quantity of product, to apply this price.

Default value, starting from version 14.5.0, set as false.

Before version 14.5.0, default value was set to 0, but its use was causing an error. That's why when using function on installations with module version lower than 14.5.0, you need to directly indicate false.

Numerical value (any) can be set only in case, if base price is created in the extended price editing mode (price dependency on quantity).
4.0.4
quantityTo This price no longer applies when product quantity is purchased.

Default value, starting from version 14.5.0 set as false.

Before version 14.5.0, default value was set to 0, but its use was causing an error. That's why when using function on installations with module version lower than 14.5.0, you need to directly indicate false. Numerical value (any) can be set only in case, if base price is created in the extended price editing mode (price dependency on quantity).
4.0.4
bGetID When set as false, returns true after price is defined. Otherwise record ID is set inside the table.10.0.4

Returned value

Returns true on successfully saved price and false otherwise.



© «Bitrix24», 2001-2024
Up