/** * @return String HTML */ public function getHTML() { $productArray = $this->catalog->getProducts(); $ret = "<ul>"; foreach ($productArray as $product) { $title = $product->getTitle(); $price = $product->getPrice(); $unique = $product->getUniqueString(); $url = $this->navigation->getURLToProduct($unique); $ret .= "<li><a href='{$url}'>{$title}</a> {$price}</li>"; } $ret .= "</ul>"; return "<h2>Product Catalog</h2> {$ret}"; }
public function getProductList(\model\ProductCatalog $catalog) { $ret = "<h1>Products</h1>\n\n\t\t<ul>"; foreach ($catalog->getProducts() as $key => $product) { $name = $product->getName(); $price = $product->getPrice(); $unique = $product->getUniqueProductID(); $url = $this->url->getURLWithArgument(self::$productURLID, $unique); $ret .= "<li>"; $ret .= "<a href='{$url}'>{$name}</a> "; $ret .= "{$price} sek</li>"; } $ret .= "</ul>"; return $ret; }