0

I wanted to build a static block in Magento where when a customer logs in they see there name with a welcome message (dependant on name length), however it appears on implementation that the previous logged in customers details are being stored, yet i have static block cache turned off.

<?php $customer = Mage::getSingleton('customer/session')->getCustomer(); 
    $firstName = $customer->getFirstname();

    if(strlen($firstName) > 10 ) { 
        echo "Hey $firstName!";
    } else {
        echo "Hey there!";
    }
?>

I have loaded this into my theme file by declaring it as a static block

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('custom_name')->toHtml(); ?>

And created a static block in Magento with the following:

{{block type="core/template" cache_lifetime="null" name="customname" template="customname/customname.phtml"}}

Can anyone advise why this could be caching?

Thanks

  • In which file you are calling your static block ? – Pawan Aug 15 '18 at 12:17
  • Hi Pawan, I am calling this in the header.phtml (we have two themes) however this is also being called in partially into a Wordpress header. So I believe that it could be our WP Cache plugin that could also be caching this information. – Kirsty Marks Aug 16 '18 at 15:06

Your Answer

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

Browse other questions tagged or ask your own question.