public function getSelectedProduct(\model\ProductCatalog $catalog) { if (isset($_GET[self::$productURLID])) { $item = $_GET[self::$productURLID]; return $catalog->getProduct($item); } return false; }
/** * @throws Exception if the key is unkown * @return \model\Product */ public function getSelectedProduct() { assert($this->navigation->customerWantsToSeeProduct()); $unique = $this->navigation->getProductID(); $product = $this->catalog->getProductFromUnique($unique); if ($product != null) { return $product; } throw new \Exception("unknown key"); }