Skip to content

Instantly share code, notes, and snippets.

View Pum-purum's full-sized avatar
🏠
Working from home

Андрей Pum-purum

🏠
Working from home
  • Russia
View GitHub Profile
@Pum-purum
Pum-purum / handlers_crm_debug.txt
Created April 10, 2019 06:57
before contact add fields
Array
(
[NAME] => кенгкег
[SECOND_NAME] => лопорл
[LAST_NAME] => 45674567
[TYPE_ID] => CLIENT
[SOURCE_ID] => CALL
[COMMENTS] =>
[OPENED] => Y
[EXPORT] => N
@Pum-purum
Pum-purum / update_company_rights.php
Created April 12, 2019 13:37
update crm rights
<?
// Обновление списка компаний для актуализации настроек прав доступа
include_once(__DIR__ . "/../../.config.php");
define("NO_KEEP_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);
define('CHK_EVENT', true);
ini_set('memory_limit', '-1');
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");
global $APPLICATION;
$arFields['RESULT_MESSAGE'] = 'Задайте контакту оригинальное имя и фамилию';
$GLOBALS['APPLICATION']->throwException('error');
@Pum-purum
Pum-purum / cron_events.php
Created June 17, 2019 10:49
Запуск скрипта в консоли
$_SERVER["DOCUMENT_ROOT"] = realpath(dirname(__FILE__)."/../..");
@Pum-purum
Pum-purum / copy-site.php
Created July 10, 2019 07:07
INSERT в базу Битрикс
$arFieldsToInsert = ['SITE' => $newLid, 'TOSITE' => $newLid, 'URLFROM' => $arRedirect['URLFROM'], 'URLTO' => $arRedirect['URLTO']];
$arInsert = $DB->PrepareInsert("v_redirect", $arFieldsToInsert);
$strSql = "INSERT INTO v_redirect(".$arInsert[0].") VALUES(".$arInsert[1].")";
$id = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
if ($id) {
echo "Редирект с " . $arRedirect['URLFROM'] . " на " . $arRedirect['URLTO'] . " успешно скопирован <br>";
}
@Pum-purum
Pum-purum / index.php
Last active October 20, 2019 17:08
cookie bitrix
use Bitrix\Main\Application;
use Bitrix\Main\Web\Cookie;
if(Application::getInstance()->getContext()->getRequest()->getCookie('FROMBUSINESS')){
$cookie = new Cookie("FROMBUSINESS", '');
Application::getInstance()->getContext()->getResponse()->addCookie($cookie);
}
@Pum-purum
Pum-purum / curl
Created July 23, 2019 12:10
curl php
$method = '/add.new.ajax';
$params = ['field' => 'value'];
$queryUrl = 'https://mycoolsite.ru' . $method;
$queryData = http_build_query($params);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_POST => 1,
@Pum-purum
Pum-purum / common.js
Created October 23, 2019 14:03
JS add and delete params
var url = new URL(location.href);
url.searchParams.delete('LG');
url.searchParams.set('LG', 'YES');
location.href = url.href;
@Pum-purum
Pum-purum / component.php
Last active November 1, 2019 11:35
bitrix property setup
CIBlockElement::SetPropertyValuesEx($ELEMENT_ID, $arParams["IBLOCK_ID"], array(
"vote_count" => array(
"VALUE" => $arProperties["vote_count"]["VALUE"],
"DESCRIPTION" => $arProperties["vote_count"]["DESCRIPTION"],
),
"vote_sum" => array(
"VALUE" => $arProperties["vote_sum"]["VALUE"],
"DESCRIPTION" => $arProperties["vote_sum"]["DESCRIPTION"],
),
"rating" => array(
@Pum-purum
Pum-purum / handlers.php
Created November 13, 2019 06:24
bitrix D7 событие в новом ядре
EventManager::getInstance()->addEventHandler(
'sale',
'OnSaleBasketSaved',
'clearSessionParameters'
);
/**
* @param \Bitrix\Main\Event $event
* @return \Bitrix\Main\EventResult|\Main\EventResult
* 14553