Not an answer as such but a few pointers as to where and what to look for.
Firstly the block that you are looking into is Mage_Reports_Block_Product_Viewed
. In this block you will see the function _toHtml
and in this function you will see that it checks to see if there are items in the cache and if not then it will load them from the database.
protected function _toHtml()
{
if (!$this->getCount()) {
return '';
}
$this->setRecentlyViewedProducts($this->getItemsCollection());
return parent::_toHtml();
}
If you venture into the function Mage_Reports_Block_Product_Abstract::getItemsCollection
what you will see is that it builds the product collection. There are a few things to take note here.
Limit by customer
If there is a customer id then it adds the filter to the collection.
if ($this->getCustomerId()) {
$this->_collection->setCustomerId($this->getCustomerId());
}
Excludes some products
There is an exclusion of some products.
$this->_collection->excludeProductIds($this->_getModel()->getExcludeProductIds())
But for products viewed it simply excludes the current product being viewed if there is one.
Using this information I think you will be able to look into the functions and debug what is actually going wrong with your code.