3

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>";
     } 
 ?>
2

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>
  • I am using customize template and customer name come from header.phtm file – Vaibhav Ahalpara Mar 25 '17 at 5:08
  • 1
    @vaibhavahalpara Okay, that is the issue for sure then. See my update above; you will need to remove your custom implementation and replace it with the welcome block output. By default it will say “Welcome, $name!” but you can override that by either extending the page/html_welcome block or using the locale file to change that string to <p>%s</p>. – fantasticrice Mar 25 '17 at 17:14
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.