Вывести поля производителя на отдельную страницу?

Подскажите пожалуйста. Хочу сделать персональную страницу для каждого производителя, в настройках miniShop2 добавил производителя связал его с определенным ресурсом, но не понимаю как вывести поля производителя (название, логотип, описание и т.д и т.п.) в этом ресурсе. Какие плэйсхолдеры для этого использовать? Прописываю [[+name]], [[+logo]], но ни чего не выводит, помогите кто может.
Ринат
24 июня 2017, 11:27
modx.pro
3
1 424
0

Комментарии: 2

Игорь Терентьев
25 июня 2017, 02:26
0
{$_modx->runSnippet('msVendor', [
        'vendor' => $_modx->resource.pagetitle,
        'tpl' => 'tpl.msVendor',
    ])}
tpl.msVendor:
<img src="[[+logo]]" alt="{$_modx->resource.pagetitle}" width="150px">
                        {$_modx->runSnippet('!msProducts', [
                            'parents' => 58,
                            'limit' => 18,
                            'includeThumbs' => 'medium',
                            'tpl' => 'HomeSliderItemTpl',
                            'optionFilters' => '{ "vendor:=":[[+id]] }',
                        ])}
Сниппет msVendor:
<?php
/**
 * @Author: Anton Jukov
 * https://github.com/2ball/modx/tree/master/msVendor
 * https://bezumkin.ru/sections/tips_and_tricks/2918/
 */
if (!empty($scriptProperties['vendor'])) {
    // $vendor = $modx->getObject('msVendor', $scriptProperties['vendor']);
    $vendor = $modx->getObject('msVendor', array('name' => $scriptProperties['vendor']));

    //Check vendor exist
    if (is_object($vendor)) {
        //Get fields data
        $vendor = $vendor->_fields;

        //Get content
        if ($scriptProperties['includeContent'] == 1) {
            if (!empty($vendor['resource'])) {
                $resource = $modx->getObject('modResource', $vendor['resource']);

                if (is_object($resource)) {
                    $vendor['pagetitle'] = $resource->get('pagetitle');
                    $vendor['introtext'] = $resource->get('introtext');
                    $vendor['content'] = $resource->get('content');
                }
            }
        }

        //How to return?
        if ($scriptProperties['returnData'] == 1) {
            if (!empty($scriptProperties['returnOption'])) {
                return $vendor[$scriptProperties['returnOption']];
            }
            else {
                return $vendor;
            }
        }
        else {
            $output = $modx->getChunk($scriptProperties['tpl'], $vendor);
            return $output;
        }
    }
    else {
        return false;
    }
}
else {
    return false;
}
    Ринат
    26 июня 2017, 12:23
    0
    Я новичок в этом, поэтому не совсем понимаю что здесь происходит и еще не знаком с Fenom) был бы признателен если бы вы немного пояснили что к чему.
    Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
    2