src/Backend/Modules/Commerce/Domain/Product/ProductRepository.php
/**
     * Filter and search the products and count the result.
     */
Filter and search the products and count the result.
Filter and search the products and count the result .
public function filterSearchedProductsCount(string $searchTerm, array $filters): int
    {
        $sql = 'SELECT p.* FROM commerce_products p WHERE ';
        $parameters = [];
        $this->buildSearchQuery('p', $sql, $searchTerm, $parameters);
        $this->buildFilterQuery($sql, $parameters, $filters);
        $connection = $this->getEntityManager()->getConnection();
        $stmt = $connection->prepare($sql);
        $stmt->execute($parameters);
        return (int) $stmt->fetchColumn(0);
    }
public function filterSearchedProductsCount ( string $ searchTerm , array $ filters ) : int { $ sql = 'SELECT p.* FROM commerce_products p WHERE ' ; $ parameters = [ ] ; $ this -> buildSearchQuery ( 'p' , $ sql , $ searchTerm , $ parameters ) ; $ this -> buildFilterQuery ( $ sql , $ parameters , $ filters ) ; $ connection = $ this -> getEntityManager ( ) -> getConnection ( ) ; $ stmt = $ connection -> prepare ( $ sql ) ; $ stmt -> execute ( $ parameters ) ; return ( int ) $ stmt -> fetchColumn ( 0 ) ; }
Filter and search the products and count the result.
Filter and search the products and count the result .