Skip to content

Instantly share code, notes, and snippets.

@di7spider
di7spider / hb_uf_code_generate.php
Last active September 10, 2015 12:10
1C Bitrix :: Генерация символьных кодов (UF_CODE) на основе имени (UF_NAME) для H-Инфоблоков
<?
include $_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_before.php';
use
\Bitrix\Highloadblock\HighloadBlockTable as HighloadBlockTable;
array_map('\Bitrix\Main\Loader::includeModule',
Array(
'iblock',
'highloadblock'
@di7spider
di7spider / CacheHB.php
Last active September 11, 2015 13:47
1C Bitrix :: Class cache highload block
<?
use
\Bitrix\Highloadblock\HighloadBlockTable as HighloadBlockTable;
/** Кэширование Highload блоков */
class CacheHB
{
const DEF_CACHE_FOLDER = 'cache';
const DEF_CACHE_TIME = 36000;
const DEF_CACHE_TIME_HBT = 36000;
@di7spider
di7spider / api.php
Last active September 21, 2015 12:22
1C Bitrix :: base frame API on phalconphp
<?php
define("NO_AGENT_CHECK", true);
require_once $_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_before.php';
/**
* API
*
* https://docs.phalconphp.com/ru/latest/api/index.html
@di7spider
di7spider / fx_getSectionList.php
Last active February 26, 2019 19:21
1С-bitrix :: Возвращает разделы и вложенные подразделы в иерархическом виде
<?php
/** Возвращает разделы и вложенные подразделы в иерархическом виде */
function getSectionList($filter, $select)
{
$dbSection = CIBlockSection::GetList(
Array(
'DEPTH_LEVEL' => 'ASC',
'SORT' => 'ASC'
),
@di7spider
di7spider / PUPictures.php
Created September 22, 2015 07:28
1C-Bitrix :: Загрузка изображений из папки на основе артикулов в инфоблок товаров
<?
/**
* Загрузка изображение к товаров из папки
*
* PROPS:
* Фотографии [PHOTO]
* Alt-тег для фото [ALT_TAG_PHOTO]
* Не нужен водяной знак [NO_WATER_MARK]
* Индекс SORT [SORT_PHOTO]
*/
@di7spider
di7spider / bx_create_catalog_menu.php
Last active October 8, 2015 09:43
1C-Bitrix :: Создает зеркальную копию из разделов каталога товаров в инфоблок меню и прописывает связь разделов по полю UF_LINK_CATALOG
<?php
include $_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_before.php';
define('DEF_IB_CATALOG', 1); /** ИБ каталога товаров */
define('DEF_IB_MENU_CATALOG', 2); /** ИБ каталога меню */
$arListAdd = Array();
$db = new CIBlockSection;
@di7spider
di7spider / fx_parse_params_string.php
Last active October 8, 2015 09:50
[PHP] Парсит параметризированную строку вида: "key1=value>key2=value>key3=value" в массив
<?php
function parseParams($str)
{
if( !empty($str) ){
preg_match_all('/([^>=]+)=([^>=]+)?/', $str, $arOptions);
return array_combine($arOptions[1], $arOptions[2]);
}
}
@di7spider
di7spider / fx_array_values_recursive.php
Last active October 9, 2015 12:01
[PHP] array_values_recursive по ключу
<?php
function array_values_recursive($ar, $field)
{
if( !empty($field) && array_key_exists($field, $ar) ){
$arTemp = &$ar[$field];
if( is_array($arTemp) ){
$arTemp = array_values($arTemp);
@di7spider
di7spider / Loc2Fias.php
Last active August 4, 2022 08:58
1C-Bitrix Loc2Fias :: Связка ФИАС (kladr-api.ru) с 1С-Битрикс местоположениями версии 2.0 (города/села) по ZIP коду
<?php
namespace Exchanges;
/**
* Связка ФИАС (kladr-api.ru) с 1С-Битрикс местоположениями версии 2.0 (города/села) по ZIP коду
*
* https://kladr-api.ru/
* https://dev.1c-bitrix.ru/learning/course/?COURSE_ID=43&LESSON_ID=3570
*/
@di7spider
di7spider / _dumpSQL.php
Last active May 24, 2023 12:49
1C Bitrix :: D7 SQL Dump
<?php
/** Выводит / возвращает Dump SQL запроса Bitrix D7 и старого ядра */
if( !function_exists('_dumpSQL') ){
function _dumpSQL(callable $callback, array $params = [])
{
$result = [];
if($params['user'] == 'all' || $GLOBALS['USER']-> isAdmin() ){