Skip to content

Instantly share code, notes, and snippets.

@andrei99
andrei99 / 404 page
Last active May 5, 2022 07:38
Getlist goods
//404 add statys
if(count($arSectionCurrent) === 0){
@define('ERROR_404', 'Y');
CHTTP::SetStatus('404 Not Found');
}
//404 show error page
global $APPLICATION;
if ((defined('ERROR_404')) && (ERROR_404=='Y'))
{
function sliderIndex() {
$('.items_slider_kitchen_line').not('.slick-initialized').slick({
infinite: false,
slidesToShow: 3,
slidesToScroll: 1
});
}
//ajax success
sliderIndex();
@andrei99
andrei99 / Gulp 4 full
Last active August 21, 2020 15:26
Gulp
//install global
npm install --global gulp-cli
//in project
npm init /* create package.json */
npm install gulp --save-dev
//add video youtube channel
if ($('.video_slider_youtube').length) {
$.ajax({
type: 'GET',
url: 'https://www.googleapis.com/youtube/v3/search',
data: {
order: 'date',
part: 'snippet',
channelId: 'UCBvF9cRoyNHM7AH6gJx2ZYQ',
//event sensitive scroll
window.scrollPage = false;
var ts;
$(document).bind('touchstart', function (e){
ts = e.originalEvent.touches[0].clientY;
});
$(document).bind('touchmove', function (e){
var te = e.originalEvent.changedTouches[0].clientY;
@andrei99
andrei99 / Inline Item
Last active February 7, 2018 10:31
Magnific popup
//html
<a href="#" class="call_back">Call me</a>
<div id="callback" class="item_popup mfp-hide">
<p class="name_item_popup">name popup</p>
</div>
//js
$('body').on('click', 'a.call_back', function () {
$.magnificPopup.open({
@andrei99
andrei99 / Auto complete filter
Last active June 9, 2021 14:40
Create catalog Bitrix
JCSmartFilter.prototype.postHandler = function (result, fromCache)
{
var hrefFILTER, url, curProp;
var modef = BX('modef');
var modef_num = BX('modef_num');
if (!!result && !!result.ITEMS)
{
//----------------------------------------------------------------
@andrei99
andrei99 / Add cookies site
Last active January 31, 2019 08:52
Custom items
//footer
<?// cookie to site ?>
<? if (!isset($_COOKIE['cookieSite'])): ?>
<? $APPLICATION->IncludeFile(
'/include_area/cookie_site.php',
array(),
array('MODE' => 'php')
); ?>
<? endif; ?>
@andrei99
andrei99 / Send file email bitrix
Last active July 8, 2021 08:04
Sender Bitrix
//html
<form enctype="multipart/form-data" method="post">
<input type="file" name="place_file[]" multiple>
</fotm>
//php
$obContext = Context::getCurrent();
$obRequest = $obContext->getRequest();
$arFileAll = array();
<?php
use Bitrix\Main\Loader;
use Bitrix\Main\Diag\Debug;
Loader::includeModule('iblock');
Loader::includeModule('catalog');
AddEventHandler('iblock', 'OnAfterIBlockElementAdd', 'setProductMinPrice');
AddEventHandler('iblock', 'OnAfterIBlockElementUpdate', 'setProductMinPrice');