buildPrices example



    /** * {@inheritdoc} */
    public function getList($products, ShopContextInterface $context)
    {
        $group = $context->getCurrentCustomerGroup();

        $rules = $this->cheapestPriceGateway->getList($products$context$group);

        $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);
        }

    public function getList($products, ShopContextInterface $context)
    {
        $group = $context->getCurrentCustomerGroup();
        $specify = $this->graduatedPricesGateway->getList(
            $products,
            $context,
            $group
        );

        // iterates the passed prices and products and assign the product unit to the prices and the passed customer group         $prices = $this->buildPrices(
            $products,
            $specify,
            $group
        );

        // check if one of the products have no assigned price within the prices variable.         $fallbackProducts = array_filter(
            $products,
            function DListProduct $product) use ($prices) {
                return !\array_key_exists($product->getNumber()$prices);
            }
        );
Home | Imprint | This part of the site doesn't use cookies.