/** * The catalog view handler. * * @param int $id The Product id. * @return string The HTML code. */ public function view($id = null) { $Product = new Proud(); $Product = $Product->findItem(array('Id = ' . $id)); $Client = new Client(); if (!$Product->Id) { return $this->halt(); } $Category = $Product->getCategory(); /* $this->getView()->set('Product', $Product); */ $this->getView()->set(array('Product' => $Product, 'Client' => $Client->findItem(array('Id = ' . $Product->CategoryId)))); $this->getView()->setMethod('view'); /* if ( $Product->getCategory()->getLayout() instanceof Product_Layout_Custom ) { $this->getView()->setMethod('custom'); } elseif ( $Product->getCategory()->getLayout() instanceof Product_Layout_Common ) { $this->getView()->setMethod('common'); } $this->getView()->activeMenu = $Category; $this->setContentPage($Category); $Page = $this->getContentPage(); $Page->SeoTitle = $Product->SeoTitle ? $Product->SeoTitle : $Product->Name; $Page->SeoDescription = $Product->SeoDescription; $Page->SeoKeywords = $Product->SeoKeywords; */ return $this->getView()->render(); }
/** * The function returns current product Category. * * @access public * @return object The Category. */ public function getCategory() { $Category = new Client(); return $Category->findItem(array('Id = ' . $this->CategoryId)); }