Skip to content

Instantly share code, notes, and snippets.

@qwertik17
qwertik17 / get_parent_tv.php
Created June 3, 2019 07:05
Get parent tv for modx revo
<?php
if (!$tv) return;
$tv_value = $modx->resource->getTVvalue($tv);
if (!$tv_value) {
$catalog_sections = false;
$parents_array = $modx->getParentIds($modx->resource->id);
foreach ($parents_array as $parent) {
if ($parent !== 0) {
$obj = $modx->getObject('modResource',$parent);
$tv_value = $obj->getTVvalue($tv);
@qwertik17
qwertik17 / priority_by_cron.php
Created June 3, 2019 06:58
change priority resources for modx revo
<?php
$templates = array(13,18,19);
foreach ($templates as $template) {
//Получаем количество товаров с положительным рейтингом
$query = $modx->newQuery('modResource');
$query->select(array('modResource.id as id','TemplateVarResources.value as value'));
$query->innerJoin('modTemplateVarResource','TemplateVarResources');
$query->where(array(
'TemplateVarResources.tmplvarid:=' => '133',
@qwertik17
qwertik17 / redirect_domain.php
Created June 3, 2019 06:55
redirect form multidomain for modx revo
<?php
$parent_id = $modx->resource->parent;
if ($parent_id == 0) {
return;
}
$parents = $modx->getParentIds($modx->resource->id, 10, array('context' => 'web'));
$parents = array_reverse($parents);
if ($parents[1] == 21) {
if ($cur_catalog = $modx->getObject('modResource',$parents[3])) {
if ($only_moskow = $cur_catalog->getTVvalue('only_moskow')){