Mailinglisten-Archive |
hallo Lutz
scheinbar löst es aber mein Problem noch nicht ganz..
> Und noch schöner mit foreach:
>
> $myCat = array();
>
> foreach($shoppingcart as $myArt) {
> $myProbeI = $myArt[4];
> if (!isset($myCat[$myProbeI])) {
>
>
/ /hier wird doch gar nicht unterschieden ob die kath = 1 oder was
anderes ist.(2,3,..)
> $myCat[$myProbeI] = 1;
> } else {
> $myCat[$myProbeI]++;
> }
> }
>
>
>
zählen tut es, aber sobald eine andere shippinggruppe in den Korb geht,
wird wieder -
$myCat[$myProbeI]-
überschrieben.
Noch mal zu Verdeutlichung:
Es sollen alle Artikel egal in welcher Reihenfolge die im Array liegen,
nach shipping kathegorien sortiert/gezählt werden.
item1 shipping 1
item2 shipping 2
item3 shipping 1
echo $anzahl_der_shipping1;
Ergebnis 2
echo $anzahl_der_shipping2;
Ergebnis 1
usw.usw.
Gruß
Werner
php::bar PHP Wiki - Listenarchive