login - Cómo eliminar enlaces de top.liknks al iniciar sesión/salir en Magento 1.6.2
logout magento-1.6 (2)
Ok, encontré la razón, primero son etiquetas de nivel superior y no deberían colocarse en la etiqueta predeterminada y, en segundo lugar, simplemente no funcionaba en el archivo local.xml, por lo que coloqué el código en la parte superior de customer.xml y funciona un placer. Nota: eliminé el xml que agregó enlaces a top.links, así como esto parece interferir con él.
Trabajo 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="checkout"><label>My Cart</label><url helper="checkout/cart/getCartUrl"/><title>My Cart</title><prepare/><urlParams/><position>9</position></action>
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
<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>
<!--
Load this update on every page when customer is logged out
-->
<customer_logged_out>
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>Sign up</label><url helper="customer/getRegisterUrl"/><title>Register </title><prepare/><urlParams/><position>100</position></action>
<action method="addLink" translate="label title" module="customer"><label>Log In</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>100</position></action>
<action method="removeLinkByUrl"><url helper="checkout/url/getCheckoutUrl"/></action>
<action method="removeLinkByUrl"><url helper="checkout/cart/getCartUrl"/></action>
<action method="removeLinkByUrl"><url helper="customer/getLogoutUrl"/></action>
</reference>
</customer_logged_out>
Hice una buena búsqueda y encontré las etiquetas customer_logged_in
y customer_logged_out
pero no puedo hacer que funcionen correctamente, estoy seguro de que esto se debe a mi incomprensión.
Mi objetivo es ocultar los enlaces de inicio de sesión, cuenta y pago desde el bloque top.links
cuando el usuario no está conectado y mostrarlos cuando el usuario está conectado.
He colocado lo siguiente al final de mi archivo local.xml
para intentar eliminar el enlace de inicio de sesión:
<customer_logged_in>
<reference name="top.links">
<action method="removeLinkByUrl"><url helper="customer/getLoginUrl"/></action>
</reference>
</customer_logged_in>
</default>
Pero no funciona. ¿Puede alguien explicar por qué esto no funciona? ¡Me esta volviendo loco!
La eliminación de enlaces en local.xml funciona en mi caso. Aquí está el código:
<customer_logged_in>
<reference name="top.links">
<action method="removeLinkByUrl"><url helper="customer/getLogoutUrl"/></action>
</reference>
</customer_logged_in>
<customer_logged_out>
<reference name="top.links">
<action method="removeLinkByUrl"><url helper="customer/getLoginUrl"/></action>
</reference>
</customer_logged_out>