Block/Recommended/Wishlistproducts.php
private function addRecommendedProducts(
        &$productsToDisplayCounter,
        $limit,
        $maxPerChild,
        $recommendedProducts,
        &$productsToDisplay,
        &$product
    ) {
        $i = 0;

        foreach ($recommendedProducts as $product) {
            //check if still exists
            if ($product->getId() && $productsToDisplayCounter < $limit
                && $i <= $maxPerChild
                && $product->isSaleable()
                && !$product->getParentId()
            ) {
                //we have a product to display
                $productsToDisplay[$product->getId()] = $product;
                $i++;
                $productsToDisplayCounter++;
            }
        }
    }
private function addRecommendedProducts(
        &$productsToDisplayCounter,
        $limit,
        $maxPerChild,
        $recommendedProducts,
        &$productsToDisplay,
        &$product
    ) {
        $i = 0;

        foreach ($recommendedProducts as $product) {
            //check if still exists
            if ($product->getId() && $productsToDisplayCounter < $limit
                && $i <= $maxPerChild
                && $product->isSaleable()
                && !$product->getParentId()
            ) {
                //we have a product to display
                $productsToDisplay[$product->getId()] = $product;
                $i++;
                $productsToDisplayCounter++;
            }
        }
    }
private function addRecommendedProducts ( & $ productsToDisplayCounter , $ limit , $ maxPerChild , $ recommendedProducts , & $ productsToDisplay , & $ product ) { $ i = 0 ; foreach ( $ recommendedProducts as $ product ) { //check if still exists if ( $ product -> getId ( ) && $ productsToDisplayCounter < $ limit && $ i <= $ maxPerChild && $ product -> isSaleable ( ) && ! $ product -> getParentId ( ) ) { //we have a product to display $ productsToDisplay [ $ product -> getId ( ) ] = $ product ; $ i ++ ; $ productsToDisplayCounter ++ ; } } }
Add recommended products

@param int $productsToDisplayCounter
@param int $limit
@param int $maxPerChild
@param array $recommendedProducts
@param array $productsToDisplay
@param \Magento\Catalog\Model\Product $product

@return null
Add recommended products