hasDifferentTaxes example

new DiscountContext(
                    $this->session->get('sessionId'),
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null
                )
            );
            $hasMultipleTaxes = $taxCalculator->hasDifferentTaxes($prices);

            if ($voucherDetails['percental']) {
                $voucherPrices = $taxCalculator->recalculatePercentageDiscount(-$voucherValue$prices, !$this->sSYSTEM->sUSERGROUPDATA['tax'] && $this->sSYSTEM->sUSERGROUPDATA['id']);
            } else {
                $voucherPrices = $taxCalculator->calculate($voucherDetails['value']$prices, !$this->sSYSTEM->sUSERGROUPDATA['tax'] && $this->sSYSTEM->sUSERGROUPDATA['id']);
            }

            $voucherPrices = $this->eventManager->filter(
                'Shopware_Modules_Basket_AddVoucher_VoucherPrices',
                $voucherPrices,
                [
                    
null,
                null,
                null,
                null,
                null,
                null,
                null
            )
        );

        $taxCalculator = $this->container->get('shopware.cart.proportional_tax_calculator');
        $hasDifferentTaxes = $taxCalculator->hasDifferentTaxes($positions);

        $basket[CheckoutKey::CURRENCY_ID] = $currency->getId();
        $basket[CheckoutKey::CURRENCY_NAME] = $currency->getCurrency();
        $basket[CheckoutKey::CURRENCY_FACTOR] = $currency->getFactor();

        if ($hasDifferentTaxes && empty($shippingCosts['taxMode']) && $this->get(Shopware_Components_Config::class)->get('proportionalTaxCalculation') && !$this->session->get('taxFree')) {
            $taxProportional = $taxCalculator->calculate($shippingCosts['brutto']$positions, false);

            $basket[CheckoutKey::SHIPPING_COSTS_TAX_PROPORTIONAL] = $taxProportional;

            $shippingNet = 0;

            
 {
        $this->basketQueryHelper = $basketQueryHelper;
        $this->calculator = $calculator;
    }

    /** * {@inheritdoc} */
    public function addProportionalDiscount(DiscountContext $discountContext)
    {
        $prices = $this->getPositionPrices($discountContext);
        $hasMultipleTaxes = $this->calculator->hasDifferentTaxes($prices);

        if ($discountContext->getDiscountType() === self::DISCOUNT_ABSOLUTE) {
            $discounts = $this->calculator->calculate(
                $discountContext->getDiscountValue(),
                $prices,
                $discountContext->isNetPrice()
            );
        } else {
            $discounts = $this->calculator->recalculatePercentageDiscount(
                $discountContext->getDiscountValue(),
                $prices,
                
Home | Imprint | This part of the site doesn't use cookies.