public function ProductsShowable($recursive = true)
    {
        // Figure out the categories to check
        $groupids = array($this->ID);
        if (!empty($recursive) && self::config()->include_child_groups) {
            $groupids += $this->AllChildCategoryIDs();
        }
        $products = Product::get()->filterAny(
            [
            'ParentID' => $groupids,
            'ProductCategories.ID' => $groupids
            ]
        );
        if (self::config()->must_have_price) {
            if (Product::has_extension(ProductVariationsExtension::class)) {
                $products = $products->filterAny(
                    [
                    'BasePrice:GreaterThan' => 0,
                    'Variations.Price:GreaterThan' => 0
                    ]
                );
            } else {
                $products = $products->filter('BasePrice:GreaterThan', 0);
            }
        }

        $this->extend('updateProductsShowable', $products);

        return $products;
    }
public function ProductsShowable($recursive = true)
    {
        // Figure out the categories to check
        $groupids = array($this->ID);
        if (!empty($recursive) && self::config()->include_child_groups) {
            $groupids += $this->AllChildCategoryIDs();
        }
        $products = Product::get()->filterAny(
            [
            'ParentID' => $groupids,
            'ProductCategories.ID' => $groupids
            ]
        );
        if (self::config()->must_have_price) {
            if (Product::has_extension(ProductVariationsExtension::class)) {
                $products = $products->filterAny(
                    [
                    'BasePrice:GreaterThan' => 0,
                    'Variations.Price:GreaterThan' => 0
                    ]
                );
            } else {
                $products = $products->filter('BasePrice:GreaterThan', 0);
            }
        }

        $this->extend('updateProductsShowable', $products);

        return $products;
    }
public function ProductsShowable ( $ recursive = true ) { // Figure out the categories to check $ groupids = array ( $ this -> ID ) ; if ( ! empty ( $ recursive ) && self :: config ( ) -> include_child_groups ) { $ groupids += $ this -> AllChildCategoryIDs ( ) ; } $ products = Product :: get ( ) -> filterAny ( [ 'ParentID' => $ groupids , 'ProductCategories.ID' => $ groupids ] ) ; if ( self :: config ( ) -> must_have_price ) { if ( Product :: has_extension ( ProductVariationsExtension :: class ) ) { $ products = $ products -> filterAny ( [ 'BasePrice:GreaterThan' => 0 , 'Variations.Price:GreaterThan' => 0 ] ) ; } else { $ products = $ products -> filter ( 'BasePrice:GreaterThan' , 0 ) ; } } $ this -> extend ( 'updateProductsShowable' , $ products ) ; return $ products ; }
Retrieve a set of products, based on the given parameters. Checks get query for sorting and pagination.

@param bool $recursive include sub-categories

@return DataList
Retrieve a set of products based on the given parameters . Checks get query for sorting and pagination .