This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
AddEventHandler("catalog", "OnPriceUpdate", array("MyClassUpdatePrice", "OnBeforePriceUpdateHandler")); | |
AddEventHandler("catalog", "OnPriceAdd", array("MyClassUpdatePrice", "OnBeforePriceUpdateHandler")); | |
AddEventHandler("iblock", "OnBeforeIBlockElementDelete", Array("MyClassUpdatePrice", "OnBeforeIBlockElementDeleteHandler")); | |
class MyClassUpdatePrice | |
{ | |
function OnBeforePriceUpdateHandler($PRICE_ID, $arFields) { | |
if(!$arFields['PRICE']) $arFields['PRICE'] = 0; | |
if(!$arFields['PRODUCT_ID']) $arFields['PRODUCT_ID'] = $PRICE_ID; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// method beginner | |
var el = jQuery(this); | |
el.css('pointer-events','none'); | |
// ajax code | |
// method end | |
el.css('pointer-events','auto'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Пример использования | |
* SetUserField ("BLOG_RATING", $CommentID, "UF_RATING", $Rating); | |
* echo "Рейтинг комментария: ".GetUserField ("BLOG_RATING", $CommentID, "UF_RATING"); | |
*/ | |
function SetUserField($entity_id, $value_id, $uf_id, $uf_value) { //запись значения |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?define("NOT_CHECK_PERMISSIONS", true);?> | |
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");?> | |
<? | |
if(defined('BX_UTF') && BX_UTF == TRUE){ | |
$msg = array( | |
'charset' => 'UTF-8', | |
'userChngScs' => 'Пользователь успешно изменён.', | |
'userAddScs' => 'Пользователь успешно добавлен.', | |
'delScript' => 'Удалить скрипт', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$aPropList = array(); | |
$rEnum = CIBlockProperty::GetPropertyEnum($propID, Array('SORT'=>'ASC'), Array("IBLOCK_ID"=>2)); | |
while($aEnum = $rEnum->Fetch()){ | |
$aPropList[] = array('id'=>$aEnum['ID'], 'code'=>$aEnum['XML_ID'] ,'value'=>$aEnum['VALUE']); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$aFilter = Array('IBLOCK_ID'=>9, 'DEPTH_LEVEL'=>1,"UF_SECTION_REF" => $sectionID); | |
$rSect = CIBlockSection::GetList(Array('SORT'=>'ASC'), $aFilter, false, array('UF_*')); | |
$aSections = array(); | |
while($aSect = $rSect->GetNext()) { | |
$aSections[] = $aSect; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Bitrix\Main\Application; | |
$request = Application::getInstance()->getContext()->getRequest(); | |
$value = $request->get("some_name"); | |
$value = $request["some_name"]; | |
$value = $request->getQuery("some_name"); // получение GET-параметра | |
$value = $request->getPost("some_name"); // получение POST-параметра | |
$value = $request->getFile("some_name"); // получение загруженного файла |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
array( | |
"CONDITION" => "#^/weather/([^/]+)/([^/]+)/($|index\\.php|\\?.*)#", | |
"RULE" => "COUNTRY_CODE=$1&CITY_CODE=$2", | |
"ID" => "", | |
"PATH" => "/weather/city.php", | |
), | |
/* | |
/weather/russia/moscow/ => /weather/city.php?COUNTRY_CODE=russia&CITY_CODE=moscow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Bitrix\Main\Application; | |
use Bitrix\Highloadblock\HighloadBlockTable; | |
use Bitrix\Main\Loader; | |
Loader::includeModule('highloadblock'); | |
Loader::includeModule('iblock'); | |
$hlBlockId = 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
AddEventHandler('main', 'OnEventLogGetAuditTypes', 'ASD_OnEventLogGetAuditTypes'); | |
function ASD_OnEventLogGetAuditTypes() | |
{ | |
return array('MY_OWN_TYPE' => '[MY_OWN_TYPE] Мой собственный тип'); | |
} | |
CEventLog::Add(array( | |
"SEVERITY" => "SECURITY", |