Skip to content

Instantly share code, notes, and snippets.

View demoriz's full-sized avatar

Dmitriy demoriz

  • Saint Petersburg, Russia
View GitHub Profile
@demoriz
demoriz / request.php
Last active October 20, 2023 08:46
[request ] request api #bitrix #d7
<?php
//use Bitrix\Main\Context;
use Bitrix\Main\Application;
//$context = Context::getCurrent();
//$request = $context->getRequest();
$context = Application::getInstance()->getContext();
$request = Application::getInstance()->getContext()->getRequest();
$request = Bitrix\Main\Application::getInstance()->getContext()->getRequest();
@demoriz
demoriz / csv.export.php
Last active November 11, 2016 14:12
bitrix template 'csv export'
<?php
require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/classes/general/csv_data.php';
$strFilePath = $_SERVER['DOCUMENT_ROOT'] . '/upload/catalog.csv';
$obCsvFile = new CCSVData('R', false);
$obCsvFile->LoadFile($strFilePath);
$obCsvFile->SetDelimiter(';');
$arCatalog = array();
@demoriz
demoriz / max.min.price.php
Created November 11, 2016 14:12
bitrix sale 'max & min prices'
<?php
use Bitrix\Main\Loader;
function OnPriceUpdateHandler($ID, $arFields) {
Loader::includeModule('iblock');
Loader::includeModule('catalog');
$arItem = \CCatalogSku::GetProductInfo($arFields['PRODUCT_ID']);
@demoriz
demoriz / yandex.run.php
Last active December 25, 2017 16:15
bitrix template 'yandex run'
<?php
/** @global CUser $USER */
/** @global CMain $APPLICATION */
/** @var int $IBLOCK_ID */
/** @var string $SETUP_SERVER_NAME */
/** @var string $SETUP_FILE_NAME */
/** @var array $V */
/** @var array|string $XML_DATA */
/** @var bool $firstStep */
/** @var int $CUR_ELEMENT_ID */
@demoriz
demoriz / iblock.element.add.php
Last active October 9, 2018 15:58
bitrix 'iblock element add'
<?php
use Bitrix\Main\Loader;
Loader::includeModule('iblock');
$element = new CIBlockElement;
$arFields = array(
'NAME' => '',
'IBLOCK_ID' => '',
@demoriz
demoriz / page.php
Created November 11, 2016 18:07
bitrix template 'page'
<?
require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/header.php');
$APPLICATION->SetTitle('Title');
?>
...
<? require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/footer.php'); ?>
@demoriz
demoriz / hiload.element.add.php
Last active March 5, 2024 12:39
bitrix d7 'highload element add'
<?php
use Bitrix\Highloadblock\HighloadBlockTable;
use Bitrix\Main\Loader;
Loader::includeModule('highloadblock');
// comment
// $intIblockID = 96;
// $arHLBlock = HighloadBlockTable::getById($intIblockID)->fetch();
@demoriz
demoriz / include.areas.php
Last active August 14, 2020 08:59
bitrix template 'include areas'
<?
$this->AddEditAction(
'bla',
'/bitrix/admin/public_file_edit.php?site=s1&bxpublic=Y&from=includefile&templateID=main&path='. SITE_TEMPLATE_PATH . '/include/phone.html&back_url=%2Fcatalog%2F&lang=ru&siteTemplateId=main&bxsender=core_window_cadmindialog',
'Редактировать верхний текст');
?>
<span id="<?= $this->GetEditAreaId('bla') ?>">
<? $APPLICATION->IncludeFile(
SITE_TEMPLATE_PATH . '/include/phone.html',
array(),
@demoriz
demoriz / basket.element.delete.php
Last active November 12, 2016 11:09
bitrix d7 sale 'basket element delete'
<?php
use Bitrix\Main\Context;
use Bitrix\Main\Loader;
use Bitrix\Sale\Basket;
use Bitrix\Sale\Fuser;
Loader::includeModule('sale');
$obRequest = Context::getCurrent()->getRequest();
$intItemID = 51;// id basket intres
@demoriz
demoriz / price.format.php
Last active October 22, 2017 13:21
bitrix d7 sale 'price format'
<?php
use Bitrix\Currency\CurrencyManager;
use Bitrix\Main\Loader;
Loader::includeModule('currency');
CCurrencyLang::CurrencyFormat($flPrice, CurrencyManager::getBaseCurrency());