/** * Returns the meta description. If not set, it will be generated by it's * related products. * * @return string * * @author Roland Lehmann <*****@*****.**>, Sebastian Diel <*****@*****.**> * @since 05.06.2012 */ public function getMetaDescription() { $metaDescription = $this->getLanguageFieldValue('MetaDescription'); if (!$this->getCMSFieldsIsCalled) { if (empty($metaDescription)) { $metaDescription = SilvercartSeoTools::extractMetaDescriptionOutOfArray(array($this->getTitle(), $this->getLongDescription())); } $this->extend('updateMetaDescription', $metaDescription); } return $metaDescription; }
/** * Returns the meta description. If not set, it will be generated by it's * related products or the single product in detail view * * @return string * * @author Sebastian Diel <*****@*****.**>, Ramon Kupper <*****@*****.**> * @since 06.11.2014 */ public function getMetaDescription() { $metaDescription = $this->getField('MetaDescription'); if (!$this->getCMSFieldsIsCalled) { if (empty($metaDescription)) { if (Controller::curr() instanceof SilvercartProductGroupPage_Controller && Controller::curr()->isProductDetailView()) { $product = Controller::curr()->getDetailViewProduct(); $metaDescription = $product->MetaDescription; } else { $products = $this->getProducts(); if ($products->count() > 0) { $metaDescription = SilvercartSeoTools::extractMetaDescriptionOutOfArray(array_merge(array($this->Title), $products->map()->toArray())); } } } $this->extend('updateMetaDescription', $metaDescription); } return $metaDescription; }