我想在标题标签内的产品详细信息页面上显示类别名称。
例子:
<title>Category name | Subcategory name | Product name</title>
当前设置是(目录/控制器/产品/product.php):
$this->document->setTitle($product_info['name']);
我想在标题标签内的产品详细信息页面上显示类别名称。
例子:
<title>Category name | Subcategory name | Product name</title>
当前设置是(目录/控制器/产品/product.php):
$this->document->setTitle($product_info['name']);
你可以做很多事情来实现这一点。
在第 20 行附近的某处获取类别信息:
foreach (explode('_', $this->request->get['path']) as $path_id) {
您可以将每个类别的名称添加到变量中,并将该变量添加到 settitle 部分:
只需在 foreach 之前添加变量:
$category_title_string = "";
foreach (explode('_', $this->request->get['path']) as $path_id) {
if (!$path) {
$path = $path_id;
} else {
$path .= '_' . $path_id;
}
$category_info = $this->model_catalog_category->getCategory($path_id);
//Then add the cat name to the string:
$category_title_string.= $category_info['name'] . ' - ';
在此之后只需将 settitle 更改为:
$this->document->setTitle($category_title_string.' '.$product_info['name']);