See below for a rewrite of this question.
A Magento EE 1.13.1.0 site that I'm working on is having some issues with Banners (powered by widgets.) The banners are caching when FPC is turned on, and even placing the call to the banner block in an uncached placholder/container is still pulling a cached banner block.
After talking to Magento support, they basically said that they couldn't help, but that I could look into the Related Products/Upsells to see how they stay uncached.
I know that the block catalog.product.related
and it's child block catalog.product.related.item
are both uncached. (Or rather, that they exist in the cache but are refreshed on each page load, not that I understand the difference.) But looking at Enterprise_PageCache_Model_Container_CatalogProductItem
I can't see what it is about this that keeps these blocks from caching indefinitely. Especially as it relates to Enterprise_PageCache_Model_Container_Banner
, which seems very similar.
Can anyone tell me how I can get Banners to not cache at all or give me a way to pull the content for a banner from the database directly, and bypass the cache?
Edit:
The problem that I was faced with is this: In Magento EE there is a Banner system tied to the Widget system in the CMS. The homepage of the site in question had 4 banners/widgets which were assigned to blocks. Those blocks were then called in the homepage template like so:
<!-- page.xml -->
<block type="core/text_list" name="home_banner_carousel_one" as="home_banner_carousel_one">
<label>Homepage Banner Carousel One</label>
</block>
<block type="core/text_list" name="home_banner_carousel_two" as="home_banner_carousel_two">
<label>Homepage Banner Carousel Two</label>
</block>
<block type="core/text_list" name="home_banner_carousel_three" as="home_banner_carousel_three">
<label>Homepage Banner Carousel Three</label>
</block>
<block type="core/text_list" name="home_banner_carousel_four" as="home_banner_carousel_four">
<label>Homepage Banner Carousel Four</label>
</block>
<!-- page/home.phtml -->
<ul class="home-slider">
<li><?php echo $this->getChildHtml('home_banner_carousel_one', false); ?></li>
<li><?php echo $this->getChildHtml('home_banner_carousel_two', false); ?></a></li>
<li><?php echo $this->getChildHtml('home_banner_carousel_three', false); ?></a></li>
<li><?php echo $this->getChildHtml('home_banner_carousel_four', false); ?></a></li>
</ul>
The problem was that home.phtml
was written to hide that section if the first carousel block was empty. Like this:
$carouselOne = $this->getChildHtml('home_banner_carousel_one', false);
if (empty($carouselOne)) {
echo 'Nothing here';
} else {
echo $carouselOne;
}
This was written without regard for the Full Page Cache in Magento. When that cache was turned on, this logic suddenly broke.
My solution was to move this logic into it's own block, and then try to uncache that "wrapper" block and all of the carousel blocks inside.
Simply adding <action method="setCacheLifetime" />
to the block definition in page.xml
didn't have any affect on the Enterprise Full Page Cache.
<action method="setCacheLifetime" />
andecho $this->getChildHtml('block', false);
solutions from that answer have been employed, and do not defeat the Enterprise Full Page Cache.