ОК. Пробуйте так в процессоре web/catalog/products/getdata: protected function setSelection(xPDOQuery $c) { $c = parent::setSelection($c);
.....................
if($user_id = $this->modx->user->id){
$OrdersTable = $this->modx->getTableName('Order');
$OrderProductTable = $this->modx->getTableName('OrderProduct');
$c->select(array(
"(select count(*) FROM {$OrdersTable} o
INNER JOIN {$OrderProductTable} pt on o.id = pt.order_id
where
pt.product_id = Product.id
AND o.contractor = {$user_id}
) as `exists`",
));
}
return $c;
}