public static function getAll() { $aAll = array(); if (array_key_exists('cart', $_SESSION)) { foreach ($_SESSION['cart'] as $iProductId => $iQuantity) { $oProduct = ProductManager::get($iProductId); if ($oProduct) { // product should exists ! if (false === $oProduct) { continue; } // convert to CartProduct $oProduct = CartProduct::create($oProduct); $oProduct->setQuantity($iQuantity); $aAll[] = $oProduct; } } } return $aAll; }