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 | |
class makeIblockElementUnion{ | |
static function GetListFilter($IBLOCK_ID, $arFilter, $arUnionBy, $limit, $arInputSort = array()){ | |
\Bitrix\Main\Loader::includeModule('iblock'); | |
$CIBlockElement = \Bitrix\Iblock\Iblock::wakeUp($IBLOCK_ID)->getEntityDataClass(); | |
if($CIBlockElement){ | |
if(empty($arInputSort)){ | |
$arInputSort["ID"] = "ASC"; |
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
<? | |
$eventManager = \Bitrix\Main\EventManager::getInstance(); | |
$eventManager->addEventHandler('sale', '\Bitrix\Sale\Cashbox\Internals\CashboxCheck::OnBeforeAdd', 'StopPrintCheckForEmptyDeliveryService'); | |
function StopPrintCheckForEmptyDeliveryService(\Bitrix\Main\Event $event){ | |
$BITRIX_EMPTY_DELIVERY_ID = \Bitrix\Sale\Delivery\Services\EmptyDeliveryService::getEmptyDeliveryServiceId(); | |
$arParameters = $event->getParameters(); | |
$arFields = $arParameters['fields']; | |
if("sell" == $arFields['TYPE']){ |
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
<? | |
/* | |
* выбрать ID SKU для установки SKU по умолчанию, исходя из умного фильтра. | |
* */ | |
function getOffersSelectedByFilter(&$arResult, &$arParams, $component){ | |
//https://pai-bx.com/wiki/1c-bitrix/2357-filtered-sku-in-products-list/ | |
if(!empty($arParams['FILTER_NAME'])){ | |
global ${$arParams['FILTER_NAME']}; | |
$FILTER = ${$arParams['FILTER_NAME']}; | |
if(!empty($FILTER) && !empty($FILTER['OFFERS']) ) { |
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
Если перед вами встала задача по переносу пользователей из одного Битрикс в другой, то сделать это достаточно просто. | |
Для начала составьте таблицу соответствия групп пользователей, где ключи - id группы пользователей на первом сайте, а значения id соответствующей ему группы пользователей на втором. Примерно так: | |
$tableOfGroups = [ | |
'1' => 1, | |
'2' => 2, | |
'3' => 3, | |
'4' => 4, | |
'5' => 9, |
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
<? | |
AddEventHandler("main",'OnFileSave','OnFileSave'); | |
function OnFileSave(&$arFile, $fileName, $module) | |
{ | |
if(isUserInGroup(9)){ | |
unset($arFile['tmp_name']); // to delete | |
} | |
return false; // not true; true breaks event loop | |
} |
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
В init.php, а лучше в подключаемом в нем файле: | |
подписываемся на событие OnAdminTabControlBegin (событие OnAdminTabControlBegin вызывается в функции CAdminTabControl::Begin() при выводе в административном интерфейсе формы редактирования). | |
подписываемся на событие OnAdminListDisplay (Событие OnAdminListDisplay вызывается в функции CAdminList::Display() при выводе в административном разделе списка элементов). | |
use \Bitrix\Main\EventManager; | |
$eventManager = EventManager::getInstance(); | |
$eventManager->addEventHandler('main', 'OnAdminTabControlBegin', ['\LocalNamespase\Handlers', 'onAdminTabControlBegin']); | |
$eventManager->addEventHandler('main', 'OnAdminListDisplay', ['\LocalNamespase\Handlers', 'onAdminListDisplay']); |
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
<? | |
Bitrix\Main\EventManager::getInstance()->addEventHandler( | |
'sale', | |
'OnSaleComponentOrderJsData', | |
'OnSaleComponentOrderJsData_twinpx_yadelivery_hack' | |
); | |
function OnSaleComponentOrderJsData_twinpx_yadelivery_hack(&$arResult,&$arParams) | |
{ | |
if(\Bitrix\Main\Loader::includeModule('twinpx.yadelivery')){ | |
$headStings = \Bitrix\Main\Page\Asset::getInstance()->getStrings(); |
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
function validate_url($url) { | |
return (bool)preg_match(" | |
/^ # Start at the beginning of the text | |
(?:ftp|https?|feed):\/\/ # Look for ftp, http, https or feed schemes | |
(?: # Userinfo (optional) which is typically | |
(?:(?:[\w\.\-\+!$&'\(\)*\+,;=]|%[0-9a-f]{2})+:)* # a username or a username and password | |
(?:[\w\.\-\+%!$&'\(\)*\+,;=]|%[0-9a-f]{2})+@ # combination | |
)? |
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
<? | |
$seo_duratio = ""; | |
$duration = $videoDetail->GetProperty('DURATION',true); | |
if(!empty($duration)){ | |
$obDuration = new Khill\Duration($duration); | |
$seo_duration = $obDuration->toDuration(); | |
} | |
?> |
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\Sale\Services\Base; | |
use Bitrix\Sale\Internals\Entity; | |
use Bitrix\Sale\Payment; | |
class CustomPaymentRestrict extends Base\Restriction | |
{ | |
const NAME = 'Только для админов'; | |
public static function getClassTitle() |
NewerOlder