Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Issue after placing an order with cart ^11.5 and TYPO3 v13.4 #714

@chrcan

Description

@chrcan

After placing an order using cart version ^11.5, I immediately get the following error:
PHP Warning: Undefined array key 1 in /var/www/html/vendor/extcode/cart/Classes/Domain/Model/Cart/Cart.php line 341

I fixed this issue by replacing the affected code with the following snippet and the warning disappeared:

public function getTotalTaxes(): array
{
    $taxes = $this->getSubtotalTaxes();

    $serviceTaxes = $this->getServiceTaxes();
    foreach ($serviceTaxes as $taxClassId => $tax) {
        $taxes[$taxClassId] = ($taxes[$taxClassId] ?? 0.0) + $tax;
    }

    $couponTaxes = $this->getCouponTaxes();
    foreach ($couponTaxes as $taxClassId => $tax) {
        $taxes[$taxClassId] = ($taxes[$taxClassId] ?? 0.0) - $tax;
    }

    return $taxes;
}

https://github.com/extcode/cart/blob/main/Classes/Domain/Model/Cart/Cart.php#L335-L350

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions