cart icon indicating copy to clipboard operation
cart copied to clipboard

CurrencyTranslation Error when interacting with cart

Open zale90 opened this issue 6 years ago • 3 comments

Bug Report

Current Behavior Anytime I try to access the cart (adding products etc.) this error shows up.

Expected behavior/output No currency translation errors..

Environment

  • TYPO3 version(s): 9.5.18
  • cart version: 6.9.0
  • Is your TYPO3 installation set up with Composer (Composer Mode): yes
  • OS: Debian 10

Additional context (1/1) TypeError Return value of Extcode\Cart\Domain\Model\Cart\Cart::getCurrencyTranslation() must be of the type float, null returned

Full Trace: `in /var/www/web/typo3conf/ext/cart/Classes/Domain/Model/Cart/Cart.php line 1465 * @return float */ public function getCurrencyTranslation(): float { return $this->currencyTranslation; }

/**
 * @param float $currencyTranslation

at Extcode\Cart\Domain\Model\Cart\Cart->getCurrencyTranslation() in /var/www/web/typo3conf/ext/cart/Classes/Domain/Model/Cart/Cart.php line 1499 * @return float */ public function translatePrice($price): float { $price = $price / $this->getCurrencyTranslation(); $price = round($price * 100.0) / 100.0;

    return $price;
}

at Extcode\Cart\Domain\Model\Cart\Cart->translatePrice(59.0) in /var/www/web/typo3conf/ext/cart/Classes/Domain/Model/Cart/Product.php line 441 */ public function getTranslatedPrice(): float { if ($this->cart) { return $this->cart->translatePrice($this->getPrice()); }

    return $this->getPrice();
}

at Extcode\Cart\Domain\Model\Cart\Product->getTranslatedPrice() in /var/www/web/typo3conf/ext/cart/Classes/Domain/Model/Cart/Product.php line 498 * @return float */ public function getQuantityDiscountPrice(int $quantity = null): float { $price = $this->getTranslatedPrice();

    $quantity = $quantity ? $quantity : $this->getQuantity();

    if ($this->getQuantityDiscounts()) {

at Extcode\Cart\Domain\Model\Cart\Product->getQuantityDiscountPrice(null) in /var/www/web/typo3conf/ext/cart/Classes/Domain/Model/Cart/Product.php line 532 * @return float */ public function getBestPrice(int $quantity = null) { $bestPrice = $this->getQuantityDiscountPrice($quantity);

    if ($this->getTranslatedSpecialPrice() && ($this->getTranslatedSpecialPrice() < $bestPrice)) {
        $bestPrice = $this->getTranslatedSpecialPrice();
    }

at Extcode\Cart\Domain\Model\Cart\Product->getBestPrice() in /var/www/web/typo3conf/ext/cart/Classes/Domain/Model/Cart/Product.php line 876 $sum += $variant->getGross(); } $this->gross = $sum; } else { $this->gross = $this->getBestPrice() * $this->quantity; } } else { $this->calcNet(); $this->calcTax(); at Extcode\Cart\Domain\Model\Cart\Product->calcGross() in /var/www/web/typo3conf/ext/cart/Classes/Domain/Model/Cart/Product.php line 716 public function getGross(): float { $gross = 0.0; if ($this->isQuantityInRange()) { $this->calcGross(); $gross = $this->gross; } return $gross; } at Extcode\Cart\Domain\Model\Cart\Product->getGross() in /var/www/web/typo3conf/ext/cart/Classes/Domain/Model/Cart/Cart.php line 1068

        $this->calcAll();
    } else {
        $this->subCount($product->getQuantity());
        $this->subGross($product->getGross());
        $this->subNet($product->getNet());
        $this->subTax($product->getTax(), $product->getTaxClass());

        unset($this->products[$product->getId()]);`

zale90 avatar May 20 '20 13:05 zale90

This error does not happen in 6.8.2

zale90 avatar May 20 '20 14:05 zale90

@zale90 could you check whether this error still exists in the current version?

rintisch avatar Mar 24 '24 19:03 rintisch

I will close this ticket due to missing feedback. You're off course still welcome to respond!

rintisch avatar Apr 06 '24 09:04 rintisch