Commit 7f499fd9 by wd

fix没有数据时keyword为null

parent f6912097
......@@ -44,10 +44,10 @@ class CategoryLoadAfter implements \Magento\Framework\Event\ObserverInterface
$oldMetaKeyword = $category->getMetaKeywords();
$category->setMetaTitle('Buy the Latest ' . $str['title'] .' on '.$this->url->getBaseUrl());
$category->setMetaDescription('Shop ' . $str['title'] . '. ' . $oldMetaDescription);
if ($str['keyword']){
if ($str['keyword'] && $str['keyword'] != '.'){
$category->setMetaKeywords($str['keyword']);
}else{
$category->setMetaKeywords($oldMetaKeyword.'.');
$category->setMetaKeywords($oldMetaKeyword);
}
}
}
......@@ -83,7 +83,7 @@ class CategoryLoadAfter implements \Magento\Framework\Event\ObserverInterface
$arr['title'] .= $price .' ';
$arr['keyword'] .= $price .' '. $categoryName.',';
}
$arr['title'] = rtrim($arr['title'],' ');
$arr['title'] .= $categoryName;
$arr['keyword'] = rtrim($arr['keyword'],',') . '.';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment