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 | |
// ключ для соединения | |
$key = '6f4cb12fa15962e18c31942a3e4a73f6'; | |
// код товара | |
$code = '110086'; | |
// запрос | |
$curl = curl_init('https://api.samsonopt.ru/v1/sku/' . $code . '/stock/?api_key=' . $key); |
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
<? | |
$context = Bitrix\Main\Application::getInstance()->getContext(); | |
$request = $context->getCurrent()->getRequest(); | |
/* | |
Отслеживаем 3 GET-параметра: title, subtitle и text (заголовок, подзаголовок и текст) | |
Соответствие между GET-параметром и значением хранится в инфоблоке с ID = SUBSTUTUTION_IBLOCK | |
в свойствах с символьными кодами TITLE, SUBTITLE и TEXT соответственно | |
А сами значения в TITLE_VAL, SUBTITLE_VAL и TEXT_VAL | |
*/ |
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", "OnEndBufferContent", "deleteKernel"); | |
function deleteKernel(&$content) { | |
global $APPLICATION; | |
if (strpos($APPLICATION->GetCurDir(), "/bitrix/") !== false) { | |
return; | |
} | |
$arPatternsToRemove = Array( | |
//Убираем лишние скрипты битрикса*/ |
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
<? | |
class YoutubeVideo | |
{ | |
function __construct($video) | |
{ | |
$this->video = $video; | |
} | |
private function Prefix() |
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
// 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(); |
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
<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 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 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 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 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 . '" />'); |
NewerOlder