Question

I am working on magento enterprise 1.14.2.0 and we installed all patches that required.

I am facing issue with cache or session

when customer login to his/her account, Customer name display wrong on top link cart-item count order and customer profile are ok but name in top link is wrong.

I am using customize template

<?php 
     $session = Mage::helper('customer');
     if($session->isLoggedIn()) {
        $customer = $session->getCustomer();
        echo "<p>".$customer->getName()."</p>";
     } 
 ?>
Était-ce utile?

La solution

Magento EE already has a “hole punch” in place for the logged-in customer name. It sounds like you are not using this built-in block, so double check that your current layout and template is using this block for displaying the customer name:

<block type="page/html_header" name="header" as="header">
    ...
    <block type="page/html_welcome" name="welcome" as="welcome"/>
    ...
</block>

You should see it used in your header.phtml template, something like this:

<?php echo $this->getChildHtml('welcome') ?>

Here is the placeholder that already exists to handle this block:

app/code/core/Enterprise/PageCache/etc/cache.xml

<welcome_message>
    <block>page/html_welcome</block>
    <placeholder>WELCOME</placeholder>
    <container>Enterprise_PageCache_Model_Container_Welcome</container>
    <cache_lifetime>86400</cache_lifetime>
</welcome_message>

Autres conseils

You're going to need to read up on hole punching.

Start here:

How to hole punch a child block added inside catalog/product/list block

Then this:

https://www.pixafy.com/blog/2013/03/overcoming-magentos-full-page-cache-through-hole-punching/

Familiarize yourself with the Enterprise_PageCache_* classes. You might be able to just extend some of them. Although I fixed that particular scenario you have going a while back, it was a little more involved.

I don't have any supporting code at my disposal unfortunately, but this can get you where you need to be. Its not overly difficult once you get into it.

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top