'description' => 'articles.description',
'active' => 'articles.active',
'changeTime' => 'articles.changed',
'number' => 'detail.number',
'detailId' => 'detail.id as detailId',
'inStock' => 'detail.inStock',
'supplierName' => 'supplier.name as supplierName',
'supplierId' => 'supplier.id as supplierId',
];
$builder->
select($fields);
$builder->
addSelect($builder->
expr()->
count('details.id'
) . ' as countDetails'
);
$builder->
innerJoin('articles.mainDetail', 'detail'
);
$builder->
innerJoin('articles.supplier', 'supplier'
);
$builder->
leftJoin('articles.details', 'details'
);
$builder->
groupBy('articles.id'
);
// Don't search for normal articles
$displayProducts =
(bool) $this->
Request()->
getParam('articles', true
);
if (!
$displayProducts) { $builder->
andWhere('articles.configuratorSetId IS NOT NULL'
);
}