1

任何人都可以帮助我如何在客户登录后在标题中显示客户姓名

我也尝试了一些代码,但不工作controller>common>header.php

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

先感谢您

4

1 回答 1

1

您需要编辑这些文件:

控制器 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 }}

于 2018-01-26T05:51:15.753 回答