Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Commit

Permalink
Update blockbestsellers.php
Browse files Browse the repository at this point in the history
  • Loading branch information
gRoussac committed Jan 21, 2016
1 parent 852c6f0 commit d73fbd2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion blockbestsellers.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function hookDisplayHomeTab($params)
{
if (!$this->isCached('tab.tpl', $this->getCacheId('blockbestsellers-tab')))
{
BlockBestSellers::$cache_best_sellers = $this->getBestSellers($params);
$this->memoize($params);
$this->smarty->assign('best_sellers', BlockBestSellers::$cache_best_sellers);
}

Expand All @@ -218,6 +218,7 @@ public function hookDisplayHome($params)
{
if (!$this->isCached('blockbestsellers-home.tpl', $this->getCacheId('blockbestsellers-home')))
{
$this->memoize($params);
$this->smarty->assign(array(
'best_sellers' => BlockBestSellers::$cache_best_sellers,
'homeSize' => Image::getSize(ImageType::getFormatedName('home'))
Expand Down Expand Up @@ -259,6 +260,14 @@ public function hookLeftColumn($params)
{
return $this->hookRightColumn($params);
}

protected function memoize($params)
{
if (!isset(BlockBestSellers::$cache_best_sellers)) {
BlockBestSellers::$cache_best_sellers = $this->getBestSellers($params);
}
return BlockBestSellers::$cache_best_sellers;
}

protected function getBestSellers($params)
{
Expand Down

0 comments on commit d73fbd2

Please sign in to comment.