Permalink
Browse files

Need to use the referrer's page ID when category_scope is "article"

  • Loading branch information...
1 parent 9759415 commit add33f13a975506a82727092c586ad387ea8d95d @aschempp aschempp committed Oct 1, 2012
Showing with 7 additions and 5 deletions.
  1. +1 −0 system/modules/isotope/CHANGELOG-1.4.md
  2. +6 −5 system/modules/isotope/ModuleIsotopeProductList.php
@@ -7,6 +7,7 @@ Version 1.4.? (2012-??-??)
### Fixed
- Product was hidden if price was not an attribute
- Tooltip was not available when product view was loaded with ajax in the backend
+- Caching bug when category scope was "article"
Version 1.4.beta2 (2012-09-24)
@@ -122,12 +122,13 @@ protected function compile()
{
global $objPage;
$time = time();
+ $pageId = ($this->iso_category_scope == 'article' ? $GLOBALS['ISO_CONFIG']['current_article']['pid'] : $objPage->id);
$objCache = $this->Database->prepare("SELECT * FROM tl_iso_productcache
WHERE page_id=? AND module_id=? AND requestcache_id=? AND (keywords=? OR keywords='') AND (expires>$time OR expires=0)
ORDER BY keywords=''")
->limit(1)
- ->execute($objPage->id, $this->id, (int)$this->Input->get('isorc'), (string)$this->Input->get('keywords'));
+ ->execute($pageId, $this->id, (int)$this->Input->get('isorc'), (string)$this->Input->get('keywords'));
// Cache found
if ($objCache->numRows)
@@ -168,7 +169,7 @@ protected function compile()
// Display "loading products" message and add cache flag
if ($this->blnCacheProducts)
{
- $blnCacheMessage = (bool)$this->iso_productcache[$objPage->id][(int)$this->Input->get('isorc')];
+ $blnCacheMessage = (bool)$this->iso_productcache[$pageId][(int)$this->Input->get('isorc')];
if ($blnCacheMessage && !$this->Input->get('buildCache'))
{
@@ -190,7 +191,7 @@ protected function compile()
if ($blnCacheMessage != $this->blnCacheProducts)
{
$arrCacheMessage = $this->iso_productcache;
- $arrCacheMessage[$objPage->id][(int) $this->Input->get('isorc')] = $this->blnCacheProducts;
+ $arrCacheMessage[$pageId][(int) $this->Input->get('isorc')] = $this->blnCacheProducts;
$this->Database->prepare("UPDATE tl_module SET iso_productcache=? WHERE id=?")->execute(serialize($arrCacheMessage), $this->id);
}
@@ -210,10 +211,10 @@ protected function compile()
// Also delete all expired caches if we run a delete anyway
$this->Database->prepare("DELETE FROM tl_iso_productcache WHERE (page_id=? AND module_id=? AND requestcache_id=? AND keywords=?) OR (expires>0 AND expires<$time)")
- ->executeUncached($objPage->id, $this->id, (int)$this->Input->get('isorc'), (string)$this->Input->get('keywords'));
+ ->executeUncached($pageId, $this->id, (int)$this->Input->get('isorc'), (string)$this->Input->get('keywords'));
$this->Database->prepare("INSERT INTO tl_iso_productcache (page_id,module_id,requestcache_id,keywords,products,expires) VALUES (?,?,?,?,?,?)")
- ->executeUncached($objPage->id, $this->id, (int)$this->Input->get('isorc'), (string)$this->Input->get('keywords'), implode(',', $arrIds), $intExpires);
+ ->executeUncached($pageId, $this->id, (int)$this->Input->get('isorc'), (string)$this->Input->get('keywords'), implode(',', $arrIds), $intExpires);
$this->Database->unlockTables();
}

0 comments on commit add33f1

Please sign in to comment.