Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
litespeed_wiki:cache:litemage:supported_extensions:magestore-ajax-cart [2016/04/05 14:57]
Michael Alegre
litespeed_wiki:cache:litemage:supported_extensions:magestore-ajax-cart [2017/05/09 13:02] (current)
Lisa Clarke
Line 1: Line 1:
-====== Magestore - Ajaxcart ​======+====== ​Troubleshooting ​Magestore - Ajax Cart ======
  
-When enabling ​Ajaxcart ​a conflict with LiteMage can cause a blank page to be served. The following is a step-by-step example for troubleshooting this issue.+When enabling ​Ajax Cart a conflict with LiteMage can cause a blank page to be served. The following is a step-by-step example for troubleshooting this issue.
  
   - Turn on the debug log.   - Turn on the debug log.
-  - In your browser open a page from your site, you should get a blank page at this point. +  - In your browser open a page from your site. You should get a blank page at this point. 
-  - In var/​log/​system.log,​ you will see errors like: <​code>​+  - In ''​var/​log/​system.log''​, you will see errors like: <​code>​
 2016-04-04T14:​12:​24+00:​00 ERR (3): Warning: simplexml_load_string():​ &​lt;​!--Litemage esi started cart_sidebar--&​gt;&​lt;/​!--Litemage&​gt; ​ in /​home/​user/​public_html/​app/​code/​local/​Magestore/​Ajaxcart/​Helper/​Data.php on line 29 2016-04-04T14:​12:​24+00:​00 ERR (3): Warning: simplexml_load_string():​ &​lt;​!--Litemage esi started cart_sidebar--&​gt;&​lt;/​!--Litemage&​gt; ​ in /​home/​user/​public_html/​app/​code/​local/​Magestore/​Ajaxcart/​Helper/​Data.php on line 29
-</​code>​These errors are caused the following code block in "Magestore/​Ajaxcart/​Helper/​Data.php".<​code>​+</​code>​These errors are caused ​by the following code block in ''​Magestore/​Ajaxcart/​Helper/​Data.php'':​<​code>​
     /**     /**
      * get Mini cart block class      * get Mini cart block class
Line 29: Line 29:
         return $this->​_cache['​mini_cart_class'​];​         return $this->​_cache['​mini_cart_class'​];​
     }     }
-</​code>​Looking more closely at the **getMiniCartClass()** function we see:<​code>​+</​code>​Looking more closely at the ''​getMiniCartClass()'' ​function we see:<​code>​
  ​$xmlMinicart = simplexml_load_string($this->​toXMLElement($minicartBlock->​toHtml()));​  ​$xmlMinicart = simplexml_load_string($this->​toXMLElement($minicartBlock->​toHtml()));​
                 $attributes = $xmlMinicart->​attributes();​                 $attributes = $xmlMinicart->​attributes();​
-</​code>​At this point in the code, the value of **$minicartBlock** is already a hole-punched ESI block, so the function ​**toHtml()** will return something like "<​esi:​include ...>" ​which will not be understood by the **toXMLElement()** function. +</​code>​At this point in the code, the value of ''​$minicartBlock'' ​is already a hole-punched ESI block, so the function ​''​toHtml()'' ​will return something like ''​<​esi:​include ...>'' ​which will not be understood by the ''​toXMLElement()'' ​function. 
-  - From your browser, append ​**?​LITEMAGE_DEBUG=NOCACHE** to the current URL so you can see the original page without LiteMage.\\ \\ Check the HTML source window by right clicking on the page and selecting something like "View Page Source". Leave this window open.\\ \\ Now modify the previously mentioned ​**getMiniCartClass()** function in "Magestore/​Ajaxcart/​Helper/​Data.php", replacing <​code>​$this->​_cache['​mini_cart_class'​] = $minicartSelect;</​code>​ with code containing a marker like <​code>​ $this->​_cache['​mini_cart_class'​] = '​LMDD_'​ .$minicartSelect . '​_LMDD';</​code>​ Open another browser window and view the same URL as before Once again look at the source code for this page but this time search for our marker ​"LMDD_".\\ \\ You should find something like <​code>​LMDD_[class="​login_scroll"​]_LMDD</​code>​Check a few more URLs with **?​LITEMAGE_DEBUG=NOCACHE** to confirm that you always get this same string.\\ \\ Now we can go back and modify the **getMiniCartClass()** function again, this time commenting out the original logic and putting in the value directly. <​code>​public function getMiniCartClass() {+  - From your browser, append ​''​?​LITEMAGE_DEBUG=NOCACHE'' ​to the current URL so you can see the original page without LiteMage.\\ \\ Check the HTML source window by right clicking on the page and selecting something like **View Page Source**. Leave this window open.\\ \\ Now modify the previously mentioned ​''​getMiniCartClass()'' ​function in ''​Magestore/​Ajaxcart/​Helper/​Data.php''​, replacing <​code>​$this->​_cache['​mini_cart_class'​] = $minicartSelect;</​code>​ with code containing a marker like <​code>​ $this->​_cache['​mini_cart_class'​] = '​LMDD_'​ .$minicartSelect . '​_LMDD';</​code>​ Open another browser window and view the same URL as beforeOnce again look at the source code for this page but this time search for our marker ​''​LMDD_''​.\\ \\ You should find something like <​code>​LMDD_[class="​login_scroll"​]_LMDD</​code>​Check a few more URLs with ''​?​LITEMAGE_DEBUG=NOCACHE'' ​to confirm that you always get this same string.\\ \\ Now we can go back and modify the ''​getMiniCartClass()'' ​function again, this time commenting out the original logic and putting in the value directly. <​code>​public function getMiniCartClass() {
         if (!isset($this->​_cache['​mini_cart_class'​])) {         if (!isset($this->​_cache['​mini_cart_class'​])) {
          /​* ​  ​$minicartSelect = '';​ // this will not work with LiteMage          /​* ​  ​$minicartSelect = '';​ // this will not work with LiteMage
Line 51: Line 51:
     }     }
 </​code>​ </​code>​
-  - Now from your browser, view the original URL without ​**?​LITEMAGE_DEBUG=NOCACHE**. The page should now be displaying correctly.+  - Now from your browser, view the original URL without ​''​?​LITEMAGE_DEBUG=NOCACHE''​. The page should now be displaying correctly.
   - Perform any final testing and disable the debug log when done.   - Perform any final testing and disable the debug log when done.
-**Note:** Enabling mini compare will cause a similar problem and break ESI. You can fix this by following the same steps as above to modify ​**public function getMiniCompareClass()**.+**Note:** Enabling mini compare will cause a similar problem and break ESI. You can fix this by following the same steps as above to modify ​''​public function getMiniCompareClass()''​.
  • Admin
  • Last modified: 2016/04/05 14:57
  • by Michael Alegre