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_debug.txt
Created December 10, 2019 08:51
OnAfterIblockElementAdd
Array
(
[CREATED_BY] => 41
[IBLOCK_ID] => 23
[PROPERTY_VALUES] => Array
(
[COMPANY] => 484
[PROBLEMS] => Array
(
[0] => 7
@Pum-purum
Pum-purum / script.js
Created December 3, 2019 12:25
foreach in JS
for (value of this.IDS) {
$('#' + value).barrating({
theme: 'fontawesome-stars',
showSelectedRating: false,
initialRating: this,
onSelect: function (value, text, event){
var obj = this.$elem[0];
if (value == 5) {
var companyID = $(obj).data('companyid');
_this.allCorrect(value, companyID)
@Pum-purum
Pum-purum / handlers_debug.txt
Created December 2, 2019 06:15
OnAfterIBlockElementDelete fields
Array
(
[ID] => 477
[IBLOCK_ID] => 24
[WF_PARENT_ELEMENT_ID] =>
[WF_STATUS_ID] => 1
[PREVIEW_PICTURE] =>
[DETAIL_PICTURE] =>
[EXTERNAL_ID] => 477
[CODE] => o2wqynSU6Fqs
@Pum-purum
Pum-purum / feed_debug.txt
Created November 18, 2019 11:57
iblock element update event
Array
(
[CODE] => 7701233065
[MODIFIED_BY] => 5
[NAME] => ООО Для примера
[PROPERTY_VALUES] => Array
(
[88] => ООО Для примера
[89] => ООО Для примера
[91] => 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
@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 / 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 / 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 / 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 / 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>";
}