public function getCategoryActiveProductsQueryBuilder(CategoryInterface $category = null, $filter = null, $option = null)
    {
        $queryBuilder = $this->getCategoryProductsQueryBuilder($category);
        $queryBuilder->leftJoin('p.variations', 'pv')
            ->andWhere('p.parent IS NULL')      // Limit to master products or products without variations
            ->andWhere('p.enabled = :enabled')
            ->andWhere($queryBuilder->expr()->orX('pv.enabled = :enabled', 'pv.enabled IS NULL'))
            ->setParameter('enabled', true);

        if (null !== $filter) {
            // TODO manage various filter types
            $queryBuilder->andWhere(sprintf('p.%s %s :%s', $filter, '>', $filter))
                ->setParameter(sprintf(':%s', $filter), $option);
        }

        return $queryBuilder;
    }
public function getCategoryActiveProductsQueryBuilder(CategoryInterface $category = null, $filter = null, $option = null)
    {
        $queryBuilder = $this->getCategoryProductsQueryBuilder($category);
        $queryBuilder->leftJoin('p.variations', 'pv')
            ->andWhere('p.parent IS NULL')      // Limit to master products or products without variations
            ->andWhere('p.enabled = :enabled')
            ->andWhere($queryBuilder->expr()->orX('pv.enabled = :enabled', 'pv.enabled IS NULL'))
            ->setParameter('enabled', true);

        if (null !== $filter) {
            // TODO manage various filter types
            $queryBuilder->andWhere(sprintf('p.%s %s :%s', $filter, '>', $filter))
                ->setParameter(sprintf(':%s', $filter), $option);
        }

        return $queryBuilder;
    }
public function getCategoryActiveProductsQueryBuilder ( CategoryInterface $ category = null , $ filter = null , $ option = null ) { $ queryBuilder = $ this -> getCategoryProductsQueryBuilder ( $ category ) ; $ queryBuilder -> leftJoin ( 'p.variations' , 'pv' ) -> andWhere ( 'p.parent IS NULL' ) // Limit to master products or products without variations -> andWhere ( 'p.enabled = :enabled' ) -> andWhere ( $ queryBuilder -> expr ( ) -> orX ( 'pv.enabled = :enabled' , 'pv.enabled IS NULL' ) ) -> setParameter ( 'enabled' , true ) ; if ( null !== $ filter ) { // TODO manage various filter types $ queryBuilder -> andWhere ( sprintf ( 'p.%s %s :%s' , $ filter , '>' , $ filter ) ) -> setParameter ( sprintf ( ':%s' , $ filter ) , $ option ) ; } return $ queryBuilder ; }
Returns active products for a given category.

@param CategoryInterface $category
@param string            $filter
@param mixed             $option

@return QueryBuilder
Returns active products for a given category .