我想将我的退出链接放在欢迎信息旁边。
我试过这个但没有成功:
<span class="welcome-msg"><?php echo $this->getWelcome(); ?>
<?php if (! Mage::getSingleton('customer/session')->isLoggedIn()):?>
<?php echo Mage::helper('customer')->getLoginUrl(); ?>
<?php endif; ?>
</span>
答案 0 :(得分:0)
首先修复你的php:
<span class="welcome-msg"><?php echo $this->getWelcome(); ?>
<?php if (! Mage::getSingleton('customer/session')->isLoggedIn()):?>
<?php echo 1; ?>
<?php echo Mage::helper('customer')->getLoginUrl(); ?>
<?php endif; ?>
</span>
答案 1 :(得分:0)
好的,所以解决方案是使用原始的top-links:
<div class="welcome-msg"><?php echo $this->getWelcome(), $this->getChildHtml('topLinks') ?> </div>
在此之后,我不得不在customer.xml和checkout.xml中评论一些无用的行。保留未注释的内容非常重要:
<!--Load this update on every page when customer is logged in-->
<customer_logged_in>
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>100</position></action>
</reference>
</customer_logged_in>