Skip to content

Instantly share code, notes, and snippets.

@jasp402
Last active July 25, 2017 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasp402/1fdb00e5918817d1cc9ba17b6279efdf to your computer and use it in GitHub Desktop.
Save jasp402/1fdb00e5918817d1cc9ba17b6279efdf to your computer and use it in GitHub Desktop.
PHP - Bitrix (Clear fields, get list since infoBlock and set field name want clear)
CModule::IncludeModule("iblock");
$ob=CIblockElement::GetList(
array(),
array("IBLOCK_ID"=>62, "PROPERTY_PORTAL" =>885),
false,
false,
array("ID","PROPERTY_LAST_EXECUTION"));
while ($res = $ob->GetNextElement()) {
$arFields = $res->GetFields();
$arFields['PROPERTIES'] = $res->GetProperties();
//----------------------------------------------
//SET ANY DATE
//$properties["LAST_EXECUTION"] = "07/25/2017";
//----------------------------------------------
//SET CURRENT LAST_EXECUTION AND LESS NUMBER DAY
$properties["LAST_EXECUTION"] = date("m/d/Y",strtotime("-5 day",strtotime($arFields["PROPERTY_LAST_EXECUTION_VALUE"]))); //SET -5 DAY FOR PAYSPAN
//----------------------------------------------
//SET EMPTY FOR CLEAR FIELD
//$properties["LAST_EXECUTION"] = ""
//----------------------------------------------
CIBlockElement::SetPropertyValuesEx($arFields['ID'], false, $properties);
//----------------------------------------------
//VIEW FIELD LAST_EXECUTION
//echo ($arFields["PROPERTY_LAST_EXECUTION_VALUE"])."\n";
//----------------------------------------------
//VIEW ARRAY PROPERTIES ("ID","PROPERTY_LAST_EXECUTION",ETC)
var_dump($properties)."\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment