在 magento 网站顶部显示 'welcome " customer_name"'

display 'welcome " customer_name"' at the top of the magento site

当客户登录网站时,网站顶部应显示 "welcome customer"。

假设客户将登录网站。客户登录后,在网站顶部

应该是一些欢迎顾客的留言。

如何在站点顶部显示欢迎“customer_name”。

请帮我找到解决办法。

提前致谢。

您可以检查以下代码是否必须存在:

在 header.phtml 文件中

        <?php echo $this->getChildHtml('topSearch') ?>
        <p class="welcome-msg"><?php echo $this->getChildHtml('welcome') ?> <?php echo $this->getAdditionalHtml() ?></p>
        <?php echo $this->getChildHtml('topLinks') ?>

在 page.xml 文件块应该在那里:

    <block type="page/html_header" name="header" as="header">
        ..........
        <block type="page/html_welcome" name="welcome" as="welcome"/>
    </block>
    //LOAD MAGENTO 
require_once 'YOUR_PATH_TO_MAGENTO/app/Mage.php'; 
umask(0); 
Mage::app('YOUR_WEBSITE_CODE', 'website');

//GET SESSION DATA 
Mage::getSingleton('core/session', array('name'=>'frontend')); 
$session = Mage::getSingleton('customer/session', array('name'=>'frontend')); 

$customer_data = Mage::getModel('customer/customer')->$session->id);

//CHECK IF LOGGED IN 
if($session->isLoggedIn()){ 
echo 'Welcome ' . $customer_data->firstname . " " . $customer_data->lastname; 
} else { 
echo "Welcome guest"; 
}

- See more at: https://www.jnorton.co.uk/blog/magento-check-if-customer-logged#sthash.bxeDgV9U.dpuf