/** * Returns the meta keywords. If not set, it will be generated by it's * title. * * @return string * * @author Roland Lehmann <*****@*****.**>, Sebastian Diel <*****@*****.**> * @since 05.06.2012 */ public function getMetaKeywords() { $metaKeywords = $this->getLanguageFieldValue('MetaKeywords'); if (!$this->getCMSFieldsIsCalled) { if (empty($metaKeywords)) { $metaKeywords = SilvercartSeoTools::extractMetaKeywords($this->getTitle()); } $this->extend('updateMetaKeywords', $metaKeywords); } return $metaKeywords; }
/** * 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; }