tags:

views:

48

answers:

1

Hi All

For a while now I've been showing a list of best selling products in my footer, using the code below. However, I just realised that when the cache is enabled, the list doesn't get updated until I refresh the cache. Is there any way around that?

$_productCollection = Mage::getResourceModel('reports/product_collection')
->addAttributeToSelect('name')
->addAttributeToFilter('visibility', $visibility)
->addOrderedQty()
->setOrder('ordered_qty', 'desc')
$_productCollection->load();}
A: 

You need to look at disabling the cache for the footer block - or at least lowering it's ttl low enough.

There's a good example of how to do this here: http://www.magentocommerce.com/wiki/5_-_modules_and_development/block_cache_and_html_ouput

Drew