Параметр | Описание | Значение по умолчанию |
---|---|---|
$categoryId | id категории | Вывод из всех |
$tpl | шаблон для вывода | tpl.msCategoryOptions.row |
$active | Выводить только активные | Да(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function text_error(){ | |
return false; | |
die(); | |
} | |
if(isset($_POST['org'])){ | |
if($hook->getValue('org')!=''){ | |
$modx->log(xPDO::LOG_LEVEL_ERROR, 'Ошибка заполнения формы: не пустое поле антиспама'); | |
$modx->log(xPDO::LOG_LEVEL_ERROR, print_r($_POST, 1)); | |
text_error(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Перенос значений из одной опции в другую 0_о | |
// Параметры | |
$option_from = 'option_from_name'; # Из опции | |
$option_to = 'option_to_name'; # В опцию | |
// изсключаем из выборки значения опций которые не трогать | |
$sQuery = "SELECT product_id FROM `". $modx->getOption('table_prefix') ."ms2_product_options` WHERE `key` = '" . $option_to . "'"; | |
$strProdNoId = ''; # Исключаем из выборки |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Вытаскивание из базы | |
SELECT * FROM `modx_ms2_product_options` WHERE `key` = 'need_key' | |
# Поиск дублирующихся значений, мб разные и нужно что то с ними делать >.< | |
SELECT * FROM `modx_ms2_product_options` WHERE (`value` != '' AND `key` = 'key_from') AND (`value` != '' AND `key` = 'key_to') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Весь js и masonry из CDN | |
// <script src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js"></script> | |
$(function(){ | |
// Адаптивная сетка товаров | |
// $('.block_products').masonry() | |
var $container = $(".rows") | |
$container.masonry() | |
// Адаптивная сетка товаров х | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[-Вывод и работа формы при помощи плагина formit в Modx Revo, где form_app_tpl чанк с самой формой]] | |
[[!FormIt? | |
&emailTpl=`form_app_tpl` | |
&formName=`Форма из приложения` | |
&hooks=`FormItSaveForm, email` | |
&emailSubject=`[[++site_name]]: Форма из приложения` | |
&emailTo=`[email protected]` | |
&emailFrom=`[email protected]` | |
&frontend_css=`` | |
]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Должно быть включено системное событие OnWebPageInit | |
// $modx->log(modX::LOG_LEVEL_ERROR, print_r($_GET,1)); | |
if (isset($_GET['teg'])){ | |
$return = false; | |
$arrTags = explode(',', $_GET['teg']); | |
if (count($arrTags) > 1){ | |
# Если больше 1 тега то возвращяем 404 | |
$return = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (empty($parent)) {$parent = $modx->resource->id;} | |
$pids = array_merge(array($parent), $modx->getChildIds($parent)); | |
$ids = array(); | |
$q = $modx->newQuery('msProduct'); | |
$q->where(array('class_key' => 'msProduct','parent:IN' => $pids,'published' => 1,'deleted' => 0)); | |
$q->select('`msProduct`.`id`'); | |
if ($q->prepare() && $q->stmt->execute()) { | |
$ids = $q->stmt->fetchAll(PDO::FETCH_COLUMN); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*_____________________ VeryLazy ______________________*/ | |
// - Подгрузка изображений в блоках при их показе на экране | |
block_selector = '.home ._block'; // Селектор блоков | |
function VeryLazy(){ | |
if ($('html').hasClass('webp')) { | |
$(document).find(block_selector).each(function(index, element){ | |
if ($(document).scrollTop() > $(this).offset().top - $(window).height()){ | |
$(this).addClass('active').find('img[data-src],img[data-webp]').each(function() { | |
if ($(this).data().webp) |
- Создаём страницу, тип содержимого XML, шаблон пустой, содержимое в файле
содержимое страницы.xml
где заменяем tv поля для картинки под нужное, и заменяем id 3 на те ресурсы которые нужно выводить - Создаём сниппет
htmlspecialchars
с содержимымhtmlspecialchars.php
для экранизации тегов и замены путей картинок на полные, нужно в сниппете указать путо до картинок - Создаём чанк
rss.item
для вывода результатов, содержимое для него в файлеrss.item.tpl
где заменяем если нужно tv поля для вывода картинок
- Данный способ выводить RSS не только для хуяндекса, а куда угодно