getDiscountName example

->setValue('articleID', ':articleName')
            ->setValue('ordernumber', ':ordernumber')
            ->setValue('quantity', ':quantity')
            ->setValue('price', ':price')
            ->setValue('netprice', ':netPrice')
            ->setValue('tax_rate', ':taxRate')
            ->setValue('datum', ':datum')
            ->setValue('modus', ':mode')
            ->setValue('currencyFactor', ':currencyFactor')
            ->setParameters([
                'sessionId' => $discountContext->getSessionId(),
                'articleName' => $discountContext->getDiscountName(),
                'ordernumber' => $discountContext->getOrderNumber(),
                'price' => $price->getPrice(),
                'netPrice' => $price->getNetPrice(),
                'taxRate' => $price->getTaxRate(),
                'mode' => $discountContext->getBasketMode(),
                'currencyFactor' => $discountContext->getCurrencyFactor(),
                'datum' => (new DateTime())->format('Y-m-d H:i:s'),
                'articleID' => 0,
                'quantity' => 1,
            ]);

        
$prices,
                $discountContext->isNetPrice()
            );
        } else {
            $discounts = $this->calculator->recalculatePercentageDiscount(
                $discountContext->getDiscountValue(),
                $prices,
                $discountContext->isNetPrice()
            );
        }

        $discountBaseName = $discountContext->getDiscountName();
        /** @var Price $discount */
        foreach ($discounts as $discount) {
            $discountContext->setPrice($discount);
            $discountContext->setDiscountName(
                $discountBaseName . ($hasMultipleTaxes ? ' (' . $discount->getTaxRate() . '%)' : '')
            );

            $query = $this->basketQueryHelper->getInsertDiscountQuery($discountContext);
            $query->execute();

            $discountContext->setBasketId($this->basketQueryHelper->getLastInsertId());

            
Home | Imprint | This part of the site doesn't use cookies.