calculatePriceGroupDiscounts example

$number = $product->getNumber();

            if (!\array_key_exists($number$cheapestPriceData)) {
                $cheapestPriceRule = $product->getPriceRules()[0];
                $displayFromPrice = $product->displayFromPrice();
            } else {
                $cheapestPriceRule = $cheapestPriceData[$number]['price'];
                $displayFromPrice = $cheapestPriceData[$number]['different_price_count'] > 1;
            }

            if ($product->isPriceGroupActive()) {
                $cheapestPriceRule = $this->calculatePriceGroupDiscounts($product$cheapestPriceRule$context);
            }

            $product->setCheapestPriceRule($cheapestPriceRule);
            $this->priceCalculationService->calculateProduct($product$context);

            $product->setListingPrice($product->getCheapestUnitPrice());
            if ($this->config->get('calculateCheapestPriceWithMinPurchase') && $product->getCheapestPrice() instanceof Price) {
                $product->setListingPrice($product->getCheapestPrice());
            }

            $product->setDisplayFromPrice($displayFromPrice);
        }
$prices = $this->buildPrices($products$rules$group);

        // check if one of the products have no assigned price within the prices variable.         $fallbackProducts = array_filter(
            $products,
            function DBaseProduct $product) use ($prices) {
                return !\array_key_exists($product->getNumber()$prices);
            }
        );

        if (empty($fallbackProducts)) {
            return $this->calculatePriceGroupDiscounts($products$prices$context);
        }

        // if some product has no price, we have to load the fallback customer group prices for the fallbackProducts.         $fallbackPrices = $this->cheapestPriceGateway->getList(
            $fallbackProducts,
            $context,
            $context->getFallbackCustomerGroup()
        );

        $fallbackPrices = $this->buildPrices(
            $fallbackProducts,
            
Home | Imprint | This part of the site doesn't use cookies.