-1

I am working out catalog/theme/customtemplate/template/header/header1.twig

also at catalog/controller/acount/account.php

but i 'm unable to get the output. So what i have to add and at which files?

Designer
  • 875
  • 7
  • 26

2 Answers2

2

In catalog/controller/common/header.php add the following code for Customer First & last name.

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

In catalog/view/theme/your-theme/template/common/header.twig & then add following code for the first and last name.

{{ customer_firstname }}
{{ customer_lastname }}

Please refresh developer cache after changes & then check it. please see here for more details refresh cache - Disable template caching for development in OpenCart 3

HDP
  • 4,005
  • 2
  • 36
  • 58
2

It would better if you first check if the customer is logged in. The code could return errors if the customer is not logged in.

if ($this->customer->isLogged()) {
   $data['customer_firstname'] = $this->customer->getFirstName();
   $data['customer_lastname'] = $this->customer->getLastName();
   }
ovicko
  • 2,242
  • 3
  • 21
  • 37