DiscountContext example

'subject' => $this,
                'discount' => $params,
            ]
        );

        if ($notifyUntilBeforeAdd) {
            return;
        }

        if ($this->proportionalTaxCalculation && !$this->session->get('taxFree')) {
            $this->basketHelper->addProportionalDiscount(
                new DiscountContext(
                    $this->session->get('sessionId'),
                    BasketHelperInterface::DISCOUNT_PERCENT,
                    -$basketDiscount,
                    $discountName,
                    $name,
                    3,
                    $this->sSYSTEM->sCurrency['factor'],
                    !$this->sSYSTEM->sUSERGROUPDATA['tax'] && $this->sSYSTEM->sUSERGROUPDATA['id']
                )
            );
        } else {
            
$taxFree = empty($this->system->sUSERGROUPDATA['tax']) && !empty($this->system->sUSERGROUPDATA['id']);
        $sessionId = $this->session->get('sessionId');

        if ($taxFree) {
            $netPrice = $price;
        } else {
            $netPrice = round($price / (100 + $tax) * 100, 2);
        }

        if (!$taxFree && $this->config->get('proportionalTaxCalculation')) {
            $this->basketHelper->addProportionalDiscount(
                new DiscountContext(
                    $sessionId,
                    BasketHelperInterface::DISCOUNT_ABSOLUTE,
                    $price,
                    $name,
                    $orderNumber,
                    $mode,
                    $currencyFactor,
                    $taxFree
                )
            );
        } else {
            

    public function getBasket($mergeProportional = true)
    {
        $shippingCosts = $this->getShippingCosts();

        $basket = $this->basket->sGetBasket();

        $currency = $this->get('shop')->getCurrency();

        $positions = $this->container->get(BasketHelperInterface::class)->getPositionPrices(
            new DiscountContext(
                $this->session->get('sessionId'),
                null,
                null,
                null,
                null,
                null,
                null,
                null
            )
        );

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