Magento Blocks and Observer Caching

Apr 21, 2014224
Magento Blocks and Observer Caching

Cashing Magento block is quite a simple task. Let’s see how it works.

We’ll start with an example. Let’s assume you have a client who wants his store to work faster than it does at the moment. Let’s, help him.

Problem 1: A block of a module doesn’t work as fast as it should. It doesn’t matter if this module is yours or not. You can re-write this block, but it won’t solve the problem. Modules tend to update.

Problem 2: There are several templates on the page which use our block.

As a solution let’s use observers. A pretty easy solution in my opinion. You don’t have to change other’s code when there’s another solution. But If you decide that the code changes are necessary – ignore my recommendations.

There are different solutions to deal with the second problem. The most important thing is to find the difference between blocks on the page. You’re going to use these differences in the cache key. For my example I chose Alias blocks that were mentioned in Layout.

Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Igor


Partner With Us Looking for a partner that will help you to grow your business? We are the right company to develop your webstore. Feel free to get in touch with us. We will be happy to discuss your business opportunities and provide you with a Free Quote. Talk to Igor

Post a new comment

top
BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *