Question

We have a bit of a long shot here which I am hoping someone can advise on this a little.

What we have is a Login /Log out and Register / My Account in our top links section managed by layout. We are trying to use turpentine to hole punch this so that it shows the correct to links depending on loggged in status but we cant seem to get this to trigger.

Disabling varnish or blacklisting /* in the configuration it works so we know that without varnish the layout is correct.

We have tried a number of steps to try and get this to work as you will see below.

  • Range of Flush Events (all of which I think should trigger)
  • TTL set to 0
  • turpentine_cache_flag to 0
  • Applying by reference and on Block level

Can anyone confirm that the order of events we are target should lead to the cache being refreshed at a point where it would generate the correct output. If we are hitting too early or late I imagine it might be possible that the information is being refreshed but the links were correct based on the execution point?

Beyond that, advise on what can be done to force this to operate with the correct output would be appreciated.

Custom Layout XML:

<default>
        <reference name="top.links">
            <action method="setEsiOptions">
                <params>
                    <access>private</access>
                    <cacheType>per-client</cacheType>
                    <flush_events>
                        <customer_login />
                        <customer_logout />
                    </flush_events>
                </params>
            </action>
            <action method="removeLinkByUrl"><url helper="customer/getAccountUrl" /></action>
        </reference>

    </default>

    <!-- CUSTOMER XML-->
    <customer_logged_in>
        <turpentine_cache_flag value="0"/>
        <reference name="top.links">
            <action method="removeLinkByUrl"><url helper="customer/getLogoutUrl"/></action>
            <action method="removeLinkByUrl"><url helper="enterprise_invitation/data/getCustomerInvitationFormUrl" /></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>
            <action method="addLink" translate="label title before_text" module="customer"><label>My Account</label><url helper="customer/getAccountUrl" /><title>My Account</title><prepare/><urlParams/><position>50</position><li/><a>class="my-account"</a></action>
        </reference>
    </customer_logged_in>
    <customer_logged_out>
        <reference name="top.links">
            <action method="removeLinkByUrl"><url helper="customer/getLoginUrl"/></action>
            <action method="addLink" translate="label title" module="customer"><label>Login</label><url helper="customer/getLoginUrl"/><title>Login</title><prepare/><urlParams/><position>50</position><li></li><a>class="login"</a></action>
        </reference>

    </customer_logged_out>
    <!-- END CUSTOMER XML-->

page.xml (top.links) We have been unclear on support for the reference, so trying this directly on the block in the page.xml file as below:

<block type="page/template_links" name="top.links" as="topLinks">
                    <action method="setEsiOptions">
                        <params>
                            <access>private</access>
                            <flush_events>
                                <page_block_html_topmenu_gethtml_before />
                                <page_block_html_topmenu_gethtml_after/>
                                <customer_session_init />
                                <customer_login />
                                <customer_logout />
                                <visitor_init />
                            </flush_events>
                        </params>
                    </action>
                </block>
Was it helpful?

Solution

So we discovered following further debugging, there appears to be some compatibility issues between this and RWD/Our theme. So for the benefit of anyone else that is encountering a similar problem what we had to do was:

Remove from Default in customer.xml for the rwd theme the adding of register link by default configuration.

Then in customer_logged_in and customer_logged_out we are adding register or my account links through the layout updates.

Example:

<customer_logged_out>
    <reference name="top.links">
        <action method="removeLinkByUrl"><url helper="customer/getLoginUrl"/></action>
        <action method="addLink" translate="label title" module="customer"><label>Login</label><url helper="customer/getLoginUrl"/><title>Login</title><prepare/><urlParams/><position>50</position><li></li><a>class="login"</a></action>
        <action method="addLink" translate="label title" module="customer"><label>Register</label><url>/customer/account/create</url><title>Register</title><prepare/><urlParams/><position>40</position></action>
    </reference>

</customer_logged_out>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top