---
title: "Division by zero in class.tx_ttproducts_basket_div.php on line 787"
url: "https://www.typo3.net/d/30849-division-by-zero-in-classtx-ttproducts-basket-divphp-on-line-787"
source: "typo3.net"
tags: ["Extensions","Frage","PHP"]
created: "2005-09-28"
last_reply: "2005-09-29"
replies: 3
solved: false
page: 1
pages: 1
lang: "de"
---

# Division by zero in class.tx_ttproducts_basket_div.php on line 787

Extensions · 3 Antworten · gestartet 2005-09-28

## Eröffnungsbeitrag

**Unbekannter Benutzer** · 2005-09-28 · [Beitrag #1](https://www.typo3.net/d/30849-division-by-zero-in-classtx-ttproducts-basket-divphp-on-line-787/1)

Hallo,

wenn ich beim Anlegen von Produkten die "Zweite Optionspalette anzeigen" aktiviert habe, dann wird damit automatisch das Feld "Preis2" mit angezeigt. Beim speichern wird dort automatisch "0.00" eingetragen.

Dies hat dann folgenden Fehler zur Folge:
Division by zero in class.tx_ttproducts_basket_div.php on line 787

Im Quelltext steht an dieser Stelle:

```php
/* Added els4: calculating of price_discount necessary in winkelwagen.tmpl (articles in kurkenshop are excluded, because these articled will be payed with creditpoints) */
					if ( ($actItem['rec']['price'] != '0.00') && $actItem['rec']['price2'] && ($actItem['rec']['category'] != $this->conf['creditsCategory']) ) {
						$pricediscount_total_tot_units = "";
						$oldprice_total_tot_units = ($actItem['totalNoTax']/$actItem['rec']['price2'])*$actItem['rec']['price'];
						$pricediscount_total_tot_units = ($oldprice_total_tot_units - $actItem['totalNoTax']) * $actItem['rec']['unit_factor'];
						$sum_pricediscount_total_totunits += $pricediscount_total_tot_units;
					}
```

Die IF-Bedingung wird in diesem Fall erfüllt und es kommt dann logischerweise zu einer "Division by zero" in der übernächsten Zeile.

Gibts hierfür eine Lösung, außer im PHP-Code rumzuschrauben?

Gruß
Frank

## Antworten

### [#2](https://www.typo3.net/d/30849-division-by-zero-in-classtx-ttproducts-basket-divphp-on-line-787/2) · Flink · 2005-09-28

> **franky2 schrieb:**
>
> Gibts hierfür eine Lösung, außer im PHP-Code rumzuschrauben?

Die letzte Development-Version unter
<http://fholzinger.com/development/tt_products-2.2.9.5.zip>

### [#3](https://www.typo3.net/d/30849-division-by-zero-in-classtx-ttproducts-basket-divphp-on-line-787/3) · hagbard_2605 · 2005-09-28

So ein Problem habe ich auch... Aber nur so ähnlich.

Die Produktliste funktioniert einwandrei (ohne Fehlermeldung) aber wenn ich dann auf den Warenkorb gehe und dann die Bestellung vortsetzte kommt jedes Mal diese Fehlermeldung:

> Warning: Division by zero in /srv/www/htdocs/typo3_src/typo3/ext/tt_products/lib/class.tx_ttproducts_basket_div.php on line 787
>
> Warning: Cannot modify header information - headers already sent by (output started at /srv/www/htdocs/typo3_src/typo3/ext/tt_products/lib/class.tx_ttproducts_basket_div.php:787) in /srv/www/htdocs/typo3_src/typo3/sysext/cms/tslib/class.tslib_fe.php on line 2402

Sobald ich im letzten Schritt auf "Finalize" drücke, kommt eine leere Seite (Rahmenlayout natürlich schon) und diese Zeile gleich mehrmals.

> Warning: Division by zero in /srv/www/htdocs/typo3_src/typo3/ext/tt_products/lib/class.tx_ttproducts_basket_div.php on line 787

Die Bestellung wird dann auch abgewickelt, soviel ich bisher gesehen habe ;)

Ich habe die neueste Version von tt_products. Ich bitte dringend um Hilfe. Sagt mir, was ich noch posten soll, um das Problem einzukreisen...

EDIT: Ich habe mich weitestgehend nach dieser Anleitung gerichtet: <http://typo3.org/documentation/document-library/doc_shop/Tutorial-27/>

Vielen Dank!

### [#4](https://www.typo3.net/d/30849-division-by-zero-in-classtx-ttproducts-basket-divphp-on-line-787/4) · hagbard_2605 · 2005-09-29

Hat niemand eine Idee? Ich verzweifel noch.

Habe gerade nochmal von vorne angefangen aber sobald der Warenkorb irgendwo auftaucht, bekomme ich diese Fehlermeldung. Auch auf den Folgeseiten (Adresse, Bezahlung, etc.).

Nur die Listendarstellung funktioniert. Sobald ich dort (auf der gleichen Seite) den Warenkorb mit ausgeben lasse, kommen wieder die Fehler.
Der Warenkorb und die Liste sind zwei Content-Elemente...

EDIT: Ich habe die Zeile jetzt auskommentiert... Nun gehts ;) Ich hoffe ich brauche diese Zeile nicht...

---

Quelle: „Division by zero in class.tx_ttproducts_basket_div.php on line 787“, typo3.net, https://www.typo3.net/d/30849-division-by-zero-in-classtx-ttproducts-basket-divphp-on-line-787
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
