getTemplate() == null) { $this->setTemplate("ekomimeetsmage/product/richsnippets.phtml"); } return parent::_toHtml(); } /** * Returns the average * * @return float */ public function getAverage() { if ($this->_average === null) { if ($this->getProduct()->getId() > 0) { $this->_average = Mage::helper('ekomimeetsmage/average')->getAverage($this->getProduct(), false); } else { $this->_average = 0; } } return round($this->_average, 1); } /** * Returns the count * * @return int */ public function getCount() { if ($this->_count === null) { if ($this->getProduct()->getId() > 0) { $this->_count = Mage::helper('ekomimeetsmage/collection') ->getCollection($this->getProduct()) ->addFieldToFilter('state', '1') ->load() ->count(); } else { $this->_count = 0; } } return $this->_count; } /** * Returns the product * * @return Mage_Catalog_Model_Product */ public function getProduct() { if (parent::getProduct() !== null) { return parent::getProduct(); } else { $product = Mage::registry('current_product'); if ($product instanceof Mage_Catalog_Model_Product && $product->getId() > 0) { $this->setProduct($product); return $this->getProduct(); } } return Mage::getModel('catalog/product'); } }