首页 > 解决方案 > 显示名称姓 Magento 2.3.7(非会话)

问题描述

对于市场项目,我需要在他们的个人资料页面中显示卖家的姓名和姓氏。https://ibb.co/n8pfr0y

我已经有了这些信息,因为我在注册页面https://ibb.co/n8pfr0y询问卖家的姓名和姓氏,我可以在 MyAccount 页面中看到它们:https ://ibb.co/Tbr6fG3

现在查看姓名和姓氏的代码,我发现以下函数 /www/app/code/Magento/Customer/Block/Account/Dashboard/Info.php

     * Get the full name of a customer
     *
     * @return string full name
     */
    public function getName()
    {
        return $this->_helperView->getCustomerName($this->getCustomer());
    }

以这种方式调用

 <?= $block->escapeHtml($block->getName()) ?>

为什么如果我尝试在不同的 .phtml 页面 /www/app/code/Plugin/Marketplace/view/frontend/templates/seller/top-block.phtml 中使用上面的代码

不显示?

谢谢

标签: phpmagento2

解决方案


推荐阅读