Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
litespeed_wiki:cache:litemage2:troubleshooting:catch-catelog-no-cache-product [2017/11/14 17:24]
Jackson Zhang created
litespeed_wiki:cache:litemage2:troubleshooting:catch-catelog-no-cache-product [2017/11/14 19:07] (current)
Lisa Clarke
Line 1: Line 1:
-====== ​Why I see cache header ​on the homepage but not on all product pages? ​======+====== ​Cache Header Appears ​on the Homepage But Not on All Product Pages ======
  
-I can see ''​x-litespeed-cache:​ hit,​litemage''​ header on the homepage and catalog pages, but not on any product pages. Why?+I can see the ''​x-litespeed-cache:​ hit,​litemage''​ header on the homepage and catalog pages, but not on any product pages. Why? 
 + 
 +Homepage:
 {{ :​litespeed_wiki:​cache:​litemage2:​troubleshooting:​litemage2-cache-non-cacheable-page1.png?​600 |}} {{ :​litespeed_wiki:​cache:​litemage2:​troubleshooting:​litemage2-cache-non-cacheable-page1.png?​600 |}}
  
 +Product page:
 {{ :​litespeed_wiki:​cache:​litemage2:​troubleshooting:​litemage2-cache-non-cacheable-page2.png?​600 |}} {{ :​litespeed_wiki:​cache:​litemage2:​troubleshooting:​litemage2-cache-non-cacheable-page2.png?​600 |}}
  
-You will need to investigate if xml default or other layout containing ​''​cacheable="​false"''​. If with default layout, it mostly like the whole sites won't be cached at all. If on other routes, then some certain ​routesuch as all product pages won't be cached.+It is possible one of your layouts contains the string ​''​cacheable="​false"''​. If this is found in the default layout, it's likely ​the whole site won't be cached at all. If it appears in another layout, then a particular ​route (such as all product pageswon't be cached.
  
-ssh to '​app'​ folder of your Magento2 installation.+To see if this is happening in one of your layouts, ​ssh to the ''app'' folder of your Magento2 installation, and execute the following:
  
   grep -r cacheable * | grep xml | grep -v js | grep false   grep -r cacheable * | grep xml | grep -v js | grep false
  
-  [root@server1 app]# grep -r cacheable * | grep xml | grep false | grep -v js | grep xml+You will see something similar to this:
   code/​Lof/​RewardPoints/​view/​frontend/​layout/​rewardpoints_redeemcode_index.xml: ​                  <​block class="​Lof\RewardPoints\Block\Account\Dashboard\RedeemCode"​ name="​rewards.redeemcode"​ template="​account/​dashboard/​redeemcode.phtml"​ cacheable="​false"/>​   code/​Lof/​RewardPoints/​view/​frontend/​layout/​rewardpoints_redeemcode_index.xml: ​                  <​block class="​Lof\RewardPoints\Block\Account\Dashboard\RedeemCode"​ name="​rewards.redeemcode"​ template="​account/​dashboard/​redeemcode.phtml"​ cacheable="​false"/>​
   code/​Lof/​RewardPoints/​view/​frontend/​layout/​rewardpoints_transactions_index.xml: ​                <​block class="​Lof\RewardPoints\Block\Account\Dashboard\Listing"​ after="​customer_account_navigation_block"​ name="​lrw.account.poitns"​ template="​account/​dashboard/​listing.phtml"​ cacheable="​false">​   code/​Lof/​RewardPoints/​view/​frontend/​layout/​rewardpoints_transactions_index.xml: ​                <​block class="​Lof\RewardPoints\Block\Account\Dashboard\Listing"​ after="​customer_account_navigation_block"​ name="​lrw.account.poitns"​ template="​account/​dashboard/​listing.phtml"​ cacheable="​false">​
Line 35: Line 38:
   code/​RealexPayments/​HPP/​view/​frontend/​layout/​realexpayments_hpp_cards_result.xml: ​       <block class="​RealexPayments\HPP\Block\Process\Result"​ name="​realexpayments-hpp-process-result"​ template="​process/​result.phtml"​ cacheable="​false"/>​   code/​RealexPayments/​HPP/​view/​frontend/​layout/​realexpayments_hpp_cards_result.xml: ​       <block class="​RealexPayments\HPP\Block\Process\Result"​ name="​realexpayments-hpp-process-result"​ template="​process/​result.phtml"​ cacheable="​false"/>​
  
-You can analyze the code to determine that it won't be caused by ''​RealexPayments''​ or ''​Plumrocket'' ​and it should ​be caused by ''​Lof\RewardPoints''​. ​If you are familiar with Magento 2 code structure, any route from ''​view/​frontend/​layout/​catalog_product_view.xml'' ​of any module will be combine ​together and loaded to every product page. +You can analyze the code to determine that ''​RealexPayments''​ or ''​Plumrocket'' ​won't cause your product pages to be uncacheable,​ but that ''​Lof\RewardPoints'' ​//will// affect your product pagesThis is because in the Magento 2 code structure, any route from ''​view/​frontend/​layout/​catalog_product_view.xml'' ​in any module will be combined ​together and loaded to every product page.
  
-For example:+How do you figure this out? 
  
-  under app folder: +Under the ''​app'' ​folder, execute the following: 
-  ​[root@server1 app]# find . | grep '​layout/​catalog_product_view.xml'​ + 
- ​./​code/​Lof/​RewardPoints/​view/​frontend/​layout/​catalog_product_view.xml+  find . | grep '​layout/​catalog_product_view.xml'​ 
 +   
 +The result: 
 +  ​./​code/​Lof/​RewardPoints/​view/​frontend/​layout/​catalog_product_view.xml
   ./​code/​Lof/​RewardPointsBehavior/​view/​frontend/​layout/​catalog_product_view.xml   ./​code/​Lof/​RewardPointsBehavior/​view/​frontend/​layout/​catalog_product_view.xml
   ./​code/​Lof/​RewardPointsRule/​view/​frontend/​layout/​catalog_product_view.xml   ./​code/​Lof/​RewardPointsRule/​view/​frontend/​layout/​catalog_product_view.xml
   ./​code/​WeltPixel/​OwlCarouselSlider/​view/​frontend/​layout/​catalog_product_view.xml   ./​code/​WeltPixel/​OwlCarouselSlider/​view/​frontend/​layout/​catalog_product_view.xml
   ./​code/​Vegvari/​VovayatsyukAlsoviewedFix/​view/​frontend/​layout/​catalog_product_view.xml   ./​code/​Vegvari/​VovayatsyukAlsoviewedFix/​view/​frontend/​layout/​catalog_product_view.xml
-  ./​code/​Ves/​Blog/​view/​frontend/​layout/​catalog_product_view.xml-remove 
   ./​design/​frontend/​Meigee/​fortress/​Magento_Wishlist/​layout/​catalog_product_view.xml   ./​design/​frontend/​Meigee/​fortress/​Magento_Wishlist/​layout/​catalog_product_view.xml
-  ./​design/​frontend/​Meigee/​fortress/​Magento_Catalog/​layout/​catalog_product_view.xml-ORIG 
   ./​design/​frontend/​Meigee/​fortress/​Magento_Catalog/​layout/​catalog_product_view.xml   ./​design/​frontend/​Meigee/​fortress/​Magento_Catalog/​layout/​catalog_product_view.xml
  
 +Then:
 +  cd ../vendor/
 +  root@server1 vendor]# find . | grep '​layout/​catalog_product_view.xml'​
  
- +The result:
- cd ../​vendor/​ +
- ​root@server1 vendor]# find . | grep '​layout/​catalog_product_view.xml'​+
   ./​vovayatsyuk/​magento2-alsoviewed/​view/​frontend/​layout/​catalog_product_view.xml   ./​vovayatsyuk/​magento2-alsoviewed/​view/​frontend/​layout/​catalog_product_view.xml
   ./​magento/​module-product-alert/​view/​frontend/​layout/​catalog_product_view.xml   ./​magento/​module-product-alert/​view/​frontend/​layout/​catalog_product_view.xml
Line 69: Line 74:
   ./​magento/​module-msrp/​view/​frontend/​layout/​catalog_product_view.xml   ./​magento/​module-msrp/​view/​frontend/​layout/​catalog_product_view.xml
  
-Any catalog_product_view.xml ​of the above will take effect for every page, excluding catalog_product_view.xml-ORIG and catalog_product_view.xml-remove since they have different names.+Any ''​catalog_product_view.xml''​ in the above list will take effect for every page. The only module to appear in either of the above lists as well as the original search for ''​cacheable''​ is ''​Lof/​RewardPoints''​.
  
-Hence we identified the following which caused ​the problem. +Hence we have identified the cause of the problem. ​It is ''​code/​Lof/​RewardPointsBehavior/​view/​frontend/​layout/​catalog_product_view.xml'',​ which contains:                    ​ 
-  ​code/​Lof/​RewardPointsBehavior/​view/​frontend/​layout/​catalog_product_view.xml: ​                   <block class="​Lof\RewardPointsBehavior\Block\Buttons\Facebook\Like"​ name="​lrw.fb.scripts"​ template="​scripts.phtml"​ cacheable="​false"​ />+  ​<block class="​Lof\RewardPointsBehavior\Block\Buttons\Facebook\Like"​ name="​lrw.fb.scripts"​ template="​scripts.phtml"​ cacheable="​false"​ />
  
-How to make it cacheable then?+===== How to Fix the Problem =====
  
-While you can simply back up the original XML and change cacheable="​false"​ to cacheable="​ true". Please ​be aware that this solution may not work for your situation ​and may break some part of your store. ​Better ​engage our experienced Magento Developer for such troubleshooting.+While you can simply back up the original XML and change ​''​cacheable="​false"​'' ​to ''​cacheable="​ true"'',​ please ​be aware that this solution may not work for every situation. You run the risk of breaking ​some part of your store, if you are not carefulTo err on the side of caution, you may wish to engage our experienced Magento Developer for such troubleshooting.
  
  • Admin
  • Last modified: 2017/11/14 17:24
  • by Jackson Zhang