This file contains hidden or 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
| <? | |
| require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); | |
| use Bitrix\Main\Mail\Event, | |
| Bitrix\Main\Application, | |
| \Bitrix\Main\Loader; | |
| Loader::includeModule("iblock"); | |
| $request = Application::getInstance()->getContext()->getRequest(); |
This file contains hidden or 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 | |
| \Bitrix\Main\EventManager::getInstance()->addEventHandler( | |
| 'fileman', | |
| 'OnBeforeHTMLEditorScriptRuns', | |
| 'OnBeforeHTMLEditorScriptRunsHandler' | |
| ); | |
| function OnBeforeHTMLEditorScriptRunsHandler() { | |
| $path = '/local/templates/.default/'; | |
| \CJSCore::RegisterExt('citfact_html_edit', [ |
This file contains hidden or 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("catalog", "OnBeforeProductUpdate", "OnBeforeProductUpdateHandler"); | |
| function OnBeforeProductUpdateHandler($id, $arFields) { | |
| global $DB; | |
| $arMail = array(); | |
| // Если кол-во товара больше 0 | |
| if ($arFields["QUANTITY"] > 0) { | |
| // Есть ли подписчики | |
| $tableName = \Bitrix\Catalog\SubscribeTable::getTableName(); |
This file contains hidden or 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
| # все на https, кроме файла обмена с 1С (не работает он по https) | |
| RewriteCond %{HTTP:X-HTTPS} !1 | |
| RewriteCond %{REQUEST_URI} !^/bitrix/admin/1c_exchange\.php$ [NC] | |
| RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] |
This file contains hidden or 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
| // Canonical | |
| $curpage = $APPLICATION->GetCurUri(); | |
| $arPagen = array('PAGEN_1', 'PAGEN_2'); | |
| foreach ($arPagen as $pageParam) { | |
| if (strpos($curpage, $pageParam) !== false) { | |
| $newpage = 'http'; | |
| $newpage .= $_SERVER["HTTPS"] ? 's' : ''; | |
| $newpage .= '://' . $_SERVER["SERVER_NAME"]; | |
| $newpage .= $APPLICATION->GetCurPage(false); | |
| $APPLICATION->AddHeadString('<link rel="canonical" href="' . $newpage . '" />'); |
This file contains hidden or 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
| // Uniqueness of the element's code | |
| AddEventHandler("iblock", "OnAfterIBlockElementAdd", "UniquenessCode"); | |
| function UniquenessCode (&$arFields) { | |
| if ($arFields["IBLOCK_ID"] == CATALOG_IBLOCK_ID && !empty($arFields["CODE"])) { | |
| $code = $arFields["CODE"] . "-" . $arFields["ID"]; | |
| $code = str_replace("--", "-", $code); | |
| $objElement = new CIBlockElement; | |
| $objElement->Update($arFields["ID"], array("CODE" => $code)); | |
| } |
This file contains hidden or 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("sale", "OnOrderNewSendEmail", "bxModifySaleMails"); | |
| function bxModifySaleMails($orderID, &$eventName, &$arFields) { | |
| $additional_information = ''; | |
| $arOrder = CSaleOrder::GetByID($orderID); | |
| $order_props = CSaleOrderPropsValue::GetOrderProps($orderID); | |
| while ($arProps = $order_props->Fetch()){ | |
| // телефон | |
| if ($arProps['ORDER_PROPS_ID'] == 14){ | |
| $additional_information.='Телефон: '.$arProps['VALUE'].'<br>'; |
This file contains hidden or 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 GetParentSections ($id, $arTags) { | |
| \Bitrix\Main\Loader::includeModule('iblock'); | |
| if (!$arTags) | |
| $arTags = array(); | |
| $objResult = CIBlockSection::GetList( | |
| array(), array("ID" => $id, "IBLOCK_ID" => CATALOG_IBLOCK_ID), false, array("ID", "NAME", "IBLOCK_SECTION_ID", "DEPTH_LEVEL"), false | |
| ); | |
| $arResult = $objResult->GetNext(); |
This file contains hidden or 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
| <div class="scroll-up" style="display: block;"></div> | |
| <style> | |
| .scroll-up { | |
| width: 45px; | |
| height: 45px; | |
| border-radius: 25px; | |
| background: #fb5f41; | |
| position: fixed; | |
| z-index: 9999; |
This file contains hidden or 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
| // reCaptcha | |
| $url = 'https://www.google.com/recaptcha/api/siteverify'; | |
| // data POST | |
| $secret = '******'; | |
| $response = $_REQUEST['g-recaptcha-response']; | |
| $remoteip = $_SERVER['REMOTE_ADDR']; | |
| $urlData = $url . '?secret=' . $secret . '&response=' . $response . '&remoteip=' . $remoteip; | |
| $curl = curl_init(); |
OlderNewer