Skip to content

Instantly share code, notes, and snippets.

View megamosk's full-sized avatar
🎯
Focusing

megamosk

🎯
Focusing
View GitHub Profile
@SeRGei93
SeRGei93 / bitrix remove all orders
Created August 6, 2021 10:40
Битрикс удалить все заказы
<?
if (!isset($_SERVER['DOCUMENT_ROOT']) || !$_SERVER['DOCUMENT_ROOT']) {
$_SERVER['DOCUMENT_ROOT'] = dirname(__DIR__);
}
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");
\Bitrix\Main\Loader::includeModule('sale');
use Bitrix\Sale;
@andrei99
andrei99 / Create Index
Last active June 9, 2026 14:31
d7 bitrix
\Bitrix\Main\Diag\Debug::writeToFile($signatureValue, '$signatureValue2', '__#params_1.log');
//create
$iblockId = 30;
$index = \Bitrix\Iblock\PropertyIndex\Manager::createIndexer($iblockId);
$index->startIndex();
$lastId = 0;
@FlameInTheDark
FlameInTheDark / include.discount.city.name.php
Last active March 24, 2026 13:44
Добавление кастомных условий для модуля скидок в 1C Bitrix
<?php
/**
* Добавление кастомного условия для скидок.
* Подключить данный файл в init.php
*
* В данном примере устанавливается проверка города сохраненного в сессии
*/
use Bitrix\Main\Loader;
Loader::includeModule('catalog');
<?php
/**
* Масштабирует фото, сохраняет копию файла и возвращает путь к нему
* либо возвращает ссылку на картинку-заглушку
*
* ---
*
* Водяной знак - если существует файл /upload/watermark/watermark_original.png - он будет
* смасштабирован под фото и нанесен на всю поверхность с небольшим отступом от края.
@glooer
glooer / select_now.php
Created November 22, 2017 21:43
bitrix d7 orm выбор только активных элементов (с учетом даты)
<php
\Bitrix\Iblock\ElementTable::GetList([
'filter' => [
'ACTIVE' => 'Y',
[
"LOGIC" => "OR",
'<ACTIVE_FROM' => new \Bitrix\Main\DB\SqlExpression("NOW()"),
'ACTIVE_FROM' => null,
],
AddEventHandler("catalog", "OnBeforeProductUpdate", "OnBeforeProductUpdateHandler");
function OnBeforeProductUpdateHandler($id, $arFields) {
global $DB;
$arMail = array();
// Если кол-во товара больше 0
if ($arFields["QUANTITY"] > 0) {
// Есть ли подписчики
$tableName = \Bitrix\Catalog\SubscribeTable::getTableName();
@shoman4eg
shoman4eg / footerasset.php
Created March 22, 2017 11:36
Bitrix js in footer
<?php
use Bitrix\Main\Page\Asset;
class FooterAsset
{
const LOCATION = 'FOOTER_LOCATION';
public static function addJs($src, $options = [])
{
@VasiliuKr
VasiliuKr / bitrix_smart_filter_ajax.js
Last active October 26, 2022 07:17
catalog.smart.filter - ajax обновление списка без AXAJ_MODE
// В шаблоне bitrix:catalog.smart.filter редактируем script.js - ищим функцию JCSmartFilter.prototype.postHandler и редактируем следующее
//if (modef.style.display === 'none')
//{
// modef.style.display = 'inline-block';
//}
$.get(
result.FILTER_AJAX_URL,
function (data) {
@frosit
frosit / infectedFiles.md
Created May 5, 2016 22:40
Some commands for finding and clearing infected PHP files

Finding infected files with following bash commands

** Command to list all infected files:

  • grep -lr --include=*.php "eval(base64_decode" /path/to/webroot
  • grep -lr --include=*.php "eval" .
  • grep -lr --include=*.php "base64" .

Command to remove malicious code:

  • grep -lr --include=*.php "eval(base64_decode" /path/to/webroot | xargs sed -i.bak 's/<?php eval(base64_decode[^;]*;/<?php\n/g'
@s2ar
s2ar / Bitrix. Очистить свойство типа Файл.php
Last active November 20, 2021 18:54
Bitrix. Очистить свойство типа Файл.
<?php
$bx_photo = CIBlockElement::GetProperty(
$IBID,
$id,
'sort',
'asc',
array('CODE' => 'PHOTO')
);
$ar_photo = $bx_photo->Fetch();