Skip to content

Instantly share code, notes, and snippets.

\Bitrix\Main\Loader::IncludeModule("form");
CForm::GetResultAnswerArray($WEB_FORM_ID,
$arrColumns,
$arrAnswers,
$arrAnswersVarname,
array());
$arFormResult = array();
$is_filtered = null;
https://web.archive.org/web/20221130164938/https://fancyapps.com/docs/ui/fancybox/events
@EscApp2
EscApp2 / init.php
Last active March 14, 2025 13:17
getElementInComplexComponent VARIABLES getSectionInComplexComponent
<?
if(!function_exists('getElementInComplexComponent')){
function getElementInComplexComponent($arResult, $arParams, $arSelect = array()){
$arFilter = array(
"IBLOCK_ID" => $arParams["IBLOCK_ID"],
"ACTIVE" => "Y",
"GLOBAL_ACTIVE" => "Y",
);
if (0 < intval($arResult["VARIABLES"]["SECTION_ID"]))
@EscApp2
EscApp2 / CIBlockPropertyCustomVideoHostingProp.php
Created February 19, 2025 13:06
CIBlockPropertyCustomVideoHostingProp.php video vk dzen rutube
<?php
use \Bitrix\Main\Localization\Loc;
class CIBlockPropertyCustomVideoHostingProp
{
private static $showedCss = false;
private static $showedJs = false;
static public function GetUserTypeDescription()
@EscApp2
EscApp2 / __text.txt
Created January 31, 2025 13:44
Перенести товары в /product/
1)Скопировать /catalog/ в /product/index.php
*)В /product/index.php добавить
Сверху
<?
// если нужно
$APPLICATION->AddChainItem("Каталог", "/catalog/");
?>
<?
$dir = $APPLICATION->GetCurDir(false);
@EscApp2
EscApp2 / component_epilog.php
Created December 27, 2024 13:38
schema json+ld
<?
if(!empty($arResult['JSON'])){
$jsonld=str_replace("'", "\"", CUtil::PhpToJSObject($arResult['JSON']));
\Bitrix\Main\Page\Asset::getInstance()->addString('<script class="section_microdata" type="application/ld+json">'.$jsonld.'</script>');
}
@EscApp2
EscApp2 / sitemap_run.php
Created December 26, 2024 08:21 — forked from SergeyZaigraev/sitemap_run.php
Bitrix. Generation of site map on cron
<?
//Для запуска необходимой карты укажите в адресе ее ID, пример:
//sitemap_run.php?action=sitemap_run&ID=2&lang=ru
$_SERVER['DOCUMENT_ROOT'] = realpath(dirname(__FILE__) . '/../../..');
if($argv){
unset($argv[0]);
@EscApp2
EscApp2 / script.js
Created December 24, 2024 08:34
execute Function from string
function executeFunction(string, context /*, args*/){
/*
* https://stackoverflow.com/questions/7650071/is-there-a-way-to-create-a-function-from-a-string-with-javascript
* https://stackoverflow.com/questions/359788/how-to-execute-a-javascript-function-when-i-have-its-name-as-a-string
* */
var args = Array.prototype.slice.call(arguments, 2);
if(!context){
context = window;
}
if(typeof string == "string"){
@EscApp2
EscApp2 / dadata.php
Created December 23, 2024 12:21 — forked from nalgeon/dadata.php
API DaData.ru на «чистом» PHP
<?php
/**
* Используйте эти классы, если не умеете или не хотите работать с `composer`
* и использовать библиотеку [dadata-php](https://github.com/hflabs/dadata-php/).
*
* Классы не имеют внешних зависимостей, кроме `curl`. Примеры вызова внизу файла.
*/
class TooManyRequests extends Exception
@EscApp2
EscApp2 / init.php
Created November 11, 2024 13:48
Очищать старые корзины
<?
/*
* task- Нужно очищать все корзины - поставить агента 28800
* */
function clearAllBasketsAgent(){
$day = 7;
\Bitrix\Main\Loader::includeModule('sale');
$date = date('d.m.Y', time() - 86400 * $day);