Add
This class has been deprecated. It's recommended to use methods of class Bitrix\Sale\Location.
int CSaleLocation::Add( array arFields );
The method Add adds a new location, optionally including the country and the city.
Attention! Starting from version 14.10.0 this method and backward compatibility are no longer supported. It's recommended to use methods in the new Core D7. Examples of handling new core can be found here.
Parameters
Parameter | Description |
---|---|
arFields | Associated array of the location parameters. The following keys are possible:
|
Returned values
Returns the new location ID on success, or false otherwise.
Example
<? $arFields = array( "SORT" => 100, "COUNTRY_ID" => 0, "WITHOUT_CITY" => "N" ); $arCountry = array( "NAME" => "France", "SHORT_NAME" => "FR", "fr" => array( "LID" => "fr", "NAME" => "France", "SHORT_NAME" => "FR" ) "en" => array( "LID" => "en", "NAME" => "France", "SHORT_NAME" => "FR" ), ); $arFields["COUNTRY"] = $arCountry; $arCity = array( "NAME" => "Paris", "SHORT_NAME" => "Paris", "fr" => array( "LID" => "fr", "NAME" => "Paris", "SHORT_NAME" => "Paris" ), "en" => array( "LID" => "en", "NAME" => "Paris", "SHORT_NAME" => "Paris" ) ); $arFields["CITY"] = $arCity; $ID = CSaleLocation::Add($arFields); if (IntVal($ID)<=0) echo "Error adding location"; ?>
© «Bitrix24», 2001-2024