how to cache cms block in magento for sessioned and non-sessioned visits?

For a Magento enterprise site, I have a CMS page (home page) which includes a certain block of code, ‘my-products.phtml’, using the following method within the CMS page content:

{{block type="catalog/product_list" template="catalog/product/my-products.phtml"}}

The problem is that this block is really really slow and needs to be cached. The containing CMS page is cached for non-sessioned visitors, but once a user logs in, the page and the included block don’t seem to be cached at all.

There’s no session-specific code within the block so I’m wondering how to ensure that it is cached even when a user is logged in?

One thought on “how to cache cms block in magento for sessioned and non-sessioned visits?”

  1. You need to create a descendant of Mage_Catalog_Block_Product_List and use it’s alias for the block type, like “yourmodule/product_list” instead of “catalog/product_list”.

    Follow these instructions to enable it’s cache, the first example given is exactly what you need to display some product related data, but use a larger lifetime for more efficiency.

Leave a Reply

Your email address will not be published. Required fields are marked *