-6

重複の可能性:
Magento1.6.2でログイン/ログアウトするときにtop.liknksからリンクを削除する方法

ユーザーがログインするときに、登録リンクを非表示にします。誰かがこれについて私を導くことができますか?初めてです。

頭に浮かぶのはMage::getSingleton('customer/session')->getCustomer();、ですが、機能していません。

4

1 に答える 1

0

タグを使用してこれを解決するには、レイアウト ファイルを使用する必要があり<customer_logged_in>ます。

customer.xml を見ると、通常は次のようになります。

<customer_logged_in>
    <reference name="topLinks">
        <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>

と同等です<customer_logged_out>。これにより、必要な場所に移動できます。

あなたが本当にphtmlファイルでそれをしたいのなら、見てください

$this->helper('customer')->isLoggedIn();
于 2012-07-04T09:42:46.010 に答える