如何在标题上放置opencart 3.0客户名称?

时间:2018-01-26 05:35:23

标签: opencart opencart-3

可以任何人帮我如何在标题后显示客户名称 客户登录

我也尝试了一些代码但是没有用 在controller>common>header.php

$data['customer_firstname'] = $this->customer->getFirstName();
$data['customer_lastname'] = $this->customer->getLastName();

提前谢谢

1 个答案:

答案 0 :(得分:0)

您需要编辑这些文件:

控制器 catalog/controller/common/header.php

查找return $this->load->view('common/header', $data);

在它之前添加:

if($this->customer->isLogged()){
    $data['text_customer_name'] = sprintf($this->language->get('text_customer_name'), $this->customer->getFirstName(), $this->customer->getLastName());
} else {
    $data['text_customer_name'] = $this->language->get('text_account');
}

语言 catalog/language/*/common/header.php

添加: $_['text_customer_name'] = 'Hi %s %s';

查看 catalog/view/theme/*/template/common/header.twig

查找{{ text_account }}

替换为{{ text_customer_name }}