B
B
blackbb2019-12-24 14:10:14
MODX
blackbb, 2019-12-24 14:10:14

How to get parent resource id in modx revo (server file)?

Hello! There is this code in the component file:

class UserEvents2OrderHandler extends UserEventsOrderHandler implements UserEventsOrderInterface
{
    /** @var modX $modx */
    public $modx;
    /** @var UserEvents $UserEvents */
    public $UserEvents;
    /** @var array $config */
    public $config;
    /** @var miniShop2 $miniShop2 */
    public $miniShop2;
    public $separator = ",";
    /** @var array $order */
    protected $order;
    /**
     * @param  array  $config
     */
    function __construct(UserEvents & $UserEvents, array $config = [])
    {
        parent::__construct($UserEvents, $config);
        
            if ($this->order["resource"] == 57) {
                $this->order["time"] = '08:00,23:59';
            }
    }
}

You need to get the resource's parent id 57 and use it instead of 57.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
display: block, 2019-12-24
@blackbb

$this->modx->getObject('modResource', 57)->get('parent');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question