====== A LiteMage Troubleshooting Showcase ====== In this troubleshooting showcase, we will be looking at a case where a Magento site was having login/logout issues, comparison issues, and disappearing banner issues as well as the troubleshooting processes and recommended solutions to fix them. It is assumed that you are already familiar with Magento Layouts, blocks, and templates as well as how to make proper changes to them. You can find out more from the [[http://devdocs.magento.com/guides/m1x/magefordev/mage-for-dev-4.html|Magento 1.x Developer Reference]]. ==== Issue 1: Login/Logout ==== On the home page, there is a "Welcome/Login/Create an Account" section at the top. If a user logs in, we expect to see something like ''Welcome, Sam! Logout''. With LiteMage installed, we were instead seeing ''Welcome Sam! Login or Create an Account.'' In this case, LiteMage cached ''Welcome, ! Login or Create an Account'' for a logged out user and served that to the logged in user. This issue was also happening in reverse! LiteMage would instead cache ''Welcome, ! Logout'' for a logged in user, serving ''Welcome, ! Logout'' to non-logged in users. Looking further, we see that the user uses the SM Market theme. It looks like a template problem. We need to punch a hole for that piece of info along with the login button and welcome tag. (**[[litespeed_wiki:cache:litemage:troubleshooting:checking-hole-punching|How to check hole punching]]**) Since LiteMage processes these ESI blocks in small chunks, some global PHP variables initialized in header.phtml and social.phtml were not available in these chunks. These two files needed to be updated to initialize them: /home/user1/public_html/domain1.com/app/design/frontend/sm_market/default/template]# vi page/html/header.phtml /home/user1/public_html/domain1.com/app/design/frontend/sm_market/default/template]# vi page/html/social.phtml The following was added to the top of the two templates if (empty($var_yttheme)) { include (dirname(dirname(__FILE__)).'/sm/yt_prepar.php'); } according to our **[[litespeed_wiki:cache:litemage:troubleshooting:uninitialized-php-vars-injected-block|Uninitialized PHP Vars In Injected Blocks]]** page. ==== Issue 2: Punching A Bigger Hole While Still Purging Private Sections ==== Now that the initialization problem is solved, we need to punch a big hole instead of small one. Logging into the Magento Admin and entering LiteMage config, we add "header" in **Customized Block Names for "toplinks" Tag**. We also see "compare" in a toplinks block, so we add "compare" to **Additional Purge Tags for "toplinks" Blocks** as well. {{ :litespeed_wiki:cache:litemage:troubleshooting:litemage-see-minicompare-tag-add-purge.png?nolink |}} For more info on this step, check out **[[litespeed_wiki:cache:litemage:troubleshooting:logged-in-user-info-shown-to-others|Logged In Usernames/Cart Items Shown On Other User's Pages]]**. ==== Issue 3: The Case of The Disappearing Banner ==== At this point we have fixed the login/logout issue. Great! Except now the banner has disappeared from the homepage. After some further investigation, we found that the header template included logic to check if it is displaying on a frontend page or not. If it is not a frontend page, then the banner will not display. This stops us from simply punching a big hole for the header, like we did earlier. We now needed to go back and "fix" the login links. After making a copy of ''header4.phtml'', the header style file, we open it to begin modifying. [app/design/frontend/sm_market/default/template/page/html]vi header4.phtml Inside we can see the "log in" link mixed into the header template. That logic needs to be taken out and put in its own block/template so we can both hole punch it as a private block AND keep the rest of the header publicly cached.

getChildHtml('welcome') ?> getAdditionalHtml() ?>

getLayout()->createBlock('cms/block')->setBlockId('v4-call-us')->toHtml()) { ?> getLayout()->createBlock('cms/block')->setBlockId('v4-call-us')->toHtml(); ?>
We copy the code inside ''