Opencart 3.0.2.0 and Journal 3 theme customer name in Top Menu

家住魔仙堡 提交于 2021-01-06 07:20:48

问题


I want to add customer first name on Journal theme top menu module. I am adding {{ text_logged }} in top-menu.twig but it can not get text_logged from controller. How can I get text_logged from catalog/controller/common/header.php?

{% if logged %}
   {{ text_logged }}
{% endif %}

$data['text_logged'] = sprintf($this->language->get('text_logged'), $this->url->link('account/account', '', true), $this->customer->getFirstName(), $this->url->link('account/logout', '', true));

I want to see "Hello John Do" on Journal theme top menu $ US Dollar instead


回答1:


You need to add your code using ocmod or vqmod to the Journal theme common/header.tpl. I highly recommend do not change the Journal's core codes because of ridiculous cache system (even devs couldn't get rid of it). Also here is a solution : You can edit this one for your purpose




回答2:


I had contacted the developer regarding the same issue for the journal theme v3. They told me that it can be displayed using this:

Welcome back, {{ $customer_firstname }} {{ $customer_lastname }} !

to show customer firstname and lastname in menu items.

I have integrated that into my code, and it now shows the customer name, when logged in. No need to edit OC MOD



来源:https://stackoverflow.com/questions/57689880/opencart-3-0-2-0-and-journal-3-theme-customer-name-in-top-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!