Skip to content

Instantly share code, notes, and snippets.

View pavel-one's full-sized avatar

Pavel Zarubin pavel-one

View GitHub Profile
@pavel-one
pavel-one / grids.js
Created July 11, 2018 11:43
example grid tab for modx-resource
/**
* init
* @param config
*/
var recipeComponents = function(config) {
config = config || {};
recipeComponents.superclass.constructor.call(this,config);
};
@pavel-one
pavel-one / vendor.tpl
Created July 7, 2018 01:55
ms2 вывод уникальных производителей
{set $parents = '!pdoResources' | snippet: [
'returnIds' => 1,
'parents' => 9,
'depth'=> 15,
'limit' => 0,
'where' => [
'class_key' => 'msCategory'
]
]}
@pavel-one
pavel-one / tags.tpl
Created July 7, 2018 01:54
ms2 вывод уникальных тегов
{set $parents = '!pdoResources' | snippet: [
'returnIds' => 1,
'parents' => 9,
'depth'=> 15,
'limit' => 0,
'where' => [
'class_key' => 'msCategory'
]
]}
@pavel-one
pavel-one / whoisplugin.php
Last active July 2, 2018 04:38
Узнать объекты приходящие в плагин
<?php
print_r(array_keys($scriptProperties));
die;
@pavel-one
pavel-one / gallery.tpl
Created June 9, 2018 02:26
pdoResources UserFiles where
@pavel-one
pavel-one / MasonryAjax.js
Created June 9, 2018 02:25
Masonry Reload Ajax
$(document).on('pdopage_load', function(e, config, response) {
// masonry media
var $masonryContainer = $('.media__block_masonry');
if ($masonryContainer.length) {
$masonryContainer.masonry({
itemSelector: '.media__item',
gutter: '.media__gutter',
horizontalOrder: true
});
$masonryContainer.masonry( 'reloadItems' );
@pavel-one
pavel-one / msEmail.tpl
Created May 15, 2018 02:58
minishop2 custom email
{var $style = [
'logo' => 'display:block;margin: auto;',
'a' => 'color:#348eda;',
'p' => 'font-family: Arial;color: #666666;font-size: 12px;',
'h' => 'font-family:Arial;color: #111111;font-weight: 200;line-height: 1.2em;margin: 40px 20px;text-align:center;',
'h1' => 'font-size: 36px;',
'h2' => 'font-size: 28px;',
'h3' => 'font-size: 22px;',
'th' => 'font-family: Arial;text-align: left;color: #111111;',
'td' => 'font-family: Arial;text-align: left;color: #111111;border: 1px solid #eee;padding: 10px;',
@pavel-one
pavel-one / getTVcustomData.php
Created May 12, 2018 04:31
Кастомные данные для тв
<?php
//@EVAL return $modx->runSnippet('getDepartament');
$pdo = $modx->getService('pdoFetch');
$pdo->setConfig(array(
'parents' => 137,
'limit' => 0,
'sortby' => 'id',
'select' => 'id,pagetitle',
'return' => 'data',
'where' => [
@pavel-one
pavel-one / whereMounth.php
Created May 11, 2018 12:39
Популярные материалы за месяц
[[!pdoPage?
&element=`pdoResources`
&parents=`4, 12, 17, 27`
&depth=`5`
&tpl=`list_material_tpl_view`
&includeTVs=`image,views`
&where=`modResource.isfolder IS NOT UNKNOWN AND DATE(FROM_UNIXTIME(modResource.publishedon)) > DATE_SUB(NOW(), INTERVAL 1 MONTH)`
&limit=`12`
&sortby=`{"CAST(views AS DECIMAL(13,3))":"DESC"}`
&tvPrefix=``
@pavel-one
pavel-one / fenomFunc.php
Created May 1, 2018 09:56
Нужные модификаторы для ms2
<?php
/** @var modX $modx */
switch ($modx->event->name) {
case 'pdoToolsOnFenomInit':
$fenom->addModifier('round', function ($input) {
return round($input,1);
});
$fenom->addModifier('format_price', function ($input) {