1. Navigation
  2. Content

» Magento Commerce – Layered Navigation Cache Error | Chris Mckee Designs, by Chris McKee, who'd of guessed | ChrisMcKee.co.uk


16 Responses to “ Magento Commerce – Layered Navigation Cache Error ”

  1. I have a few questions:

    1. The memory consumption of the script is really high. I'm on less than 500 products and it's over 140MB.

    2. Also I'm wondering why the sleep() function is there. Without it it doesn't seem to work and the memory consumption never changes. Just wondering. Could that be adjusted to half a second with usleep()?

    3. And if you could explain how the indexer is disabled by what you did. That would help.

    4. One more thing. You can use custom code to disable that indexer by rewriting it in local.xml and creating your own model. Although I can't seem to get this to work right now. I will tell you when I figure it out.

    I hope this solution works for me, I've been working on this for a while now.

  2. Hi Thad,

    1. The memory consumption rises like nothing else; this is partly because of the complexity of the query being run and partly because Magento is bloated. As you'll note I have added the post to the bug log.

    2. Feel free; I'm delaying the script to provide a breather between the pile of processes Mage runs through zend to create the database entries. If you watch the database tables, catalogindex_eav _minimumprice and _price you'll see that it adds thousands of records.

    3. Ignore that, The fix it provides is just circumstantial. Its better to just go into the admin and turn it off under layered navigation cache. I'll change the post to reflect the changes I've made.

    4. It's easier to turn it off in the admin... Magento doesn't seem to check... granted working with magento codes a lot like finding a needle in a haystack.

    >> http://chrismckee.co.uk/magento-commerce-layered-...

    Thanks

    Chris

  3. I am getting Parse Error-Syntax Error, unexpected T_OBJECT_OPERATOR in /url/cm_cache.php line 19

  4. @Dennis Crawford use the updated script http://chrismckee.co.uk/magento-commerce-layered-...

  5. I did now I am getting the same error in different line;

    <pre class="bash">

    syntax error, unexpected T_OBJECT_OPERATOR in

    /home/content/c/e/s/cesavings/html/store/cm_cachephp.php on line 16

    </pre>

    Thanks for the help

    Dennis

  6. @Dennis Crawford Line 16 is simply setting a variable; did you download the file or copy-paste the file which would only make sense if the contents of the file wasn't right.

    <pre lang="php">$store = Mage::app()->getStore('1');</pre>

    Make sure that get store is getting the right store number; it should be 1 if you only have one store.

    Make sure the script is set to CHMOD 755 and if your systems a bit wierd (as a few hosts have proven to be) create a file called CNT and set that to 777.

  7. Chris,

    I have followed your directions to a "T". File permissions, downloading, creating an empty CNT file. If I try to run this from putty using php -f cm_cachephp.php I still get the same error regarding the store ID.

    I have checked in ADMIN and it is in fact 1. When I run this inside Firefox this is what I get; this output is generally the same but will vary depending on how many products I set to process. The page stops there and a refresh will result in the same message as below but continue with the left number sequence. I have set the products to 265 which is what we currently have. If I continue refreshing the page it will keep going and going way past my current product count.

    #1#CURRENT MEMRY USAGE = 4951504;

    #2#CURRENT MEMRY USAGE = 4951704;

    #3#CURRENT MEMRY USAGE = 4951720;

    #4#CURRENT MEMRY USAGE = 4951720;

    #5#CURRENT MEMRY USAGE = 4951720;

    #6#CURRENT MEMRY USAGE = 4951720;

  8. Chris,

    Thanks for the help you have given me, it appears I have bigger issues than worrying about this right now. Obviously GoDaddy is not the correct host to use for Magento. I am looking into a couple of other providers with SimpleHelix being the forerunner.

    Dennis

  9. @Dennis:
    Ideally you need a decent host (preferably one that actually says its a magento commerce host; as it means they've tested it) and in an ideal world MOD-PHP (Mod-apache-php) rather then PHP-CGI (FASTCGI) Which is usually the choice on shared hosts.

    So I'd say either united hosting who are the only big shared hosting providers that have proven to be good. Or a dedicated server with someone like Aplus.net or Tagadab; in which case you'll have to look at getting your server scanned for PCI Compliance (UK) or the US Equivalent.

  10. @Dennis, also look into servint, they have been our host through our magento install and have happily made any changes and quickly that we needed for magento. IE: Innodb tables, php soap etc.

  11. One other note worthy mention is never comment out core code. Put an exact copy of that file into the same folder structure under local then when you upgrade it wont overwrite your hard work. Read this post if you dont believe me.
    http://preview.tinyurl.com/pfl8el

  12. @Scott: Generally, yes you should use local folder with a copy of the structure + the file you wish to override to overload that chunk of code; In cases such as this where I'm basically commenting something out to fix an issue I prefer to leave the files as is and change the core.

    As I use SVN + Patch I can see when alterations have been made to this file and if I see that its beneficial to the file I can accept their changes over mine and "in pigs can fly" world stop using my hack to handle the layered nav. If I was using the Local file I would have to make sure I was copying my files across every time there was another change to the file.

    The Inchoo article makes sense for new users but if your comfortable enough to manage your work in SVN, using the downloader so you can upgrade automatically is a lot like giving away any control you have.

  13. Hello Chris, Perfect !! It is working for my shop (id 3) where I have 117 products, but if I do it for a shop with 1077 products (id 5) it is not working everytime some error,I was thinking that this file should be able to make it one by one... without execution time is exceeded, if I select ony 1 as $hm, not working, max execution time 150 s exceeded...

    Could you make any chnages to the script to make it working ?

    THANKS

  14. I've had your blog in my bookmarks for a couple of days now and just wanted to say that I really love your articles! ^^

  15. Hi, my friend ask my to repair his shop because he got problems with his layered navigation in Magento store.

    I was searching over the internet and I found one FIX created by Chris McKee. THX Chris

    His script was perfect but some automatic functions were missing, therefore I’ve created my own script.

    Check it here: <a href="http://jksite.com/blog/2009/07/magento-layered-navigation-cache-error" target="_blank">http://jksite.com/blog/2009/07/magento-layered-na...
    Many THX Chris!

  16. @jk Good idea; I was planning on having an updated version out a few weeks ago, I'm a bit stuck for time due to other things in the pipeline.

    Try and remember when modifying this file that initially it was written to be run from SSH to minimise the risk of cancellation and to reduce the memory consumption. The more text you write to the screen via echo, regardless of how nice verbose is, will increase the buffer and reduce the number you can process in each run.

    @spatter: thanks more and more to come. Unless I get hit by a bus that is.

    Ta

    Chris