Skip to content

Instantly share code, notes, and snippets.

@Sentinel-7
Sentinel-7 / getlist.class.php#L68
Created January 27, 2020 10:22
Сделать поиск в каталоге minishop2 по id заголовка
https://github.com/bezumkin/miniShop2/blob/master/core/components/minishop2/processors/mgr/product/getlist.class.php#L69
// начиная с 68 строки
if (!empty($query)) {
//if (is_numeric($query)) {
// $c->where(array(
// 'msProduct.id' => $query,
// 'OR:Data.article:=' => $query,
// ));
//} else {
$c->where(array(
@Sentinel-7
Sentinel-7 / head.tpl
Last active October 9, 2019 07:05
head
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="x-rim-auto-match" content="none">
<base href="{$_modx->config.site_url}" />
{if $_modx->resource.titl}
<title>{$_modx->resource.titl| ereplace:'/\"([^\"]*)\"/':'«$1»'}{if $city_name_conjugate} {$city_name_conjugate}{/if}</title>
{elseif $_modx->resource.template in [7]}
<title>{$_modx->resource.pagetitle| ereplace:'/\"([^\"]*)\"/':'«$1»'}{if $city_name_conjugate} - купить оптом {$city_name_conjugate}{/if}</title>
{elseif $_modx->resource.id in [4]}
@Sentinel-7
Sentinel-7 / tpl.mFilter2.outer.html
Created July 19, 2019 13:24
tpl.mFilter2.outer
{if $_modx->getPlaceholder('mf2_total') != 0}
<div class="row msearch2" id="mse2_mfilter">
<div class="filters">
<form action="[[~[[*id]]]]" method="post" id="mse2_filters">
<div class="left">
[[+mf2_ms|vendor:vendors]]
<div class="for_hid">
@Sentinel-7
Sentinel-7 / fenom
Last active June 1, 2024 00:47
MIGX + разбивка по 3 блока
{set $rows = 1 | resource : 'partner' | fromJSON}
<div>
<ul class="partners">
{foreach $rows as $row index=$idx}
<li><a href="{$row.url}"><img src="{$row.image}" alt=""></a>{$idx}</li>
{if ($idx+1) % 3 == 0 && count($rows) > $idx+1 }
</ul> </div> <div> <ul class="partners">
{/if}
{/foreach}
@Sentinel-7
Sentinel-7 / script.js
Last active June 1, 2024 00:47
AjaxForm закрытие окна после отправки + fancybox
<script>
$(document).ready(function() {
AjaxForm.Message.success = function() {};
});
$(document).on('af_complete', function(event,res) {
if(res.success) $('.fancybox-close-small').click();
if (res.success) {
// показываем сообщение об успехе
$.fancybox.close();
@Sentinel-7
Sentinel-7 / plugin
Created January 25, 2018 15:48
Grabber
<?php
define('ROOT', MODX_BASE_PATH);
define('EX', 'jpg,png,gif,jpeg,doc,xls,zip,pdf'); // Через запятую имена расширений (нижний регистр)
$folder=isset($folder) ? $folder : "assets/images/"; // папка назначения стыренного контента
if(!is_dir(MODX_BASE_PATH.$folder)) mkdir(MODX_BASE_PATH.$folder);
// Функция траслита
function rus2translit($string) {
$converter = array(
'а' => 'a', 'б' => 'b', 'в' => 'v',
'г' => 'g', 'д' => 'd', 'е' => 'e',
// начиная с 367 строке
{
xtype: 'bannery-filter-resources'
,fieldLabel: _('bannery.ads.url')
,name: 'url'
,description: _('bannery.ads.url.description')
,anchor: '99%'
,allowBlank: true
},{
xtype: 'textarea'
@Sentinel-7
Sentinel-7 / AceTv plugin
Created December 19, 2017 07:04
AceTv plugin для подсветки кода
//там ещё RTE подключается для определенные категорий ресуров)
//создаем плагин AceTv, событие на «OnDocFormRender» с кодом:
$script = '';
$resource = ($resource instanceof modResource)
?
$modx->getObject('modResource',$resource->get('id'))
: $modx->getObject('modResource',(int)$resource);
// ACE
@Sentinel-7
Sentinel-7 / file.js
Created October 3, 2017 11:50
HTML + js +pdf
<script type="text/javascript" src="//code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script type="text/javascript" src="https://github.com/niklasvh/html2canvas/releases/download/v0.5.0-beta4/html2canvas.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/MrRio/jsPDF/master/dist/jspdf.min.js"></script>
<script type='text/javascript'>
function demoFromHTML() {
var pdf = new jsPDF('p', 'pt', 'letter');
var options = {ignore}{background: '#fff'}{/ignore};
var pdfContainer = $(".pdf");
@Sentinel-7
Sentinel-7 / context_key
Last active August 30, 2017 12:50
Babel
{'!pdoMenu' | snippet : [
'parents' => '[[*context_key:is=`web`:then=`1`:else=`[[*context_key:is=`en`:then=`8`]]`]]',
'level' => '1',
'tplOuter' => '@INLINE <div class="dropdown">{{+wrapper}}</div>',
'tpl' => '@INLINE <p><a href="{{+link}}" {{+attributes}}>{{+menutitle}}</a></p>'
]}