cart icon indicating copy to clipboard operation
cart copied to clipboard

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

Open chrcan opened this issue 2 months ago • 0 comments

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

chrcan avatar Nov 06 '25 15:11 chrcan