View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003485 | OXID eShop (all versions) | 4.05. Performance | public | 2012-01-05 16:14 | 2012-12-10 13:29 |
Reporter | tomas_liubinas | Assigned To | |||
Priority | high | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Fixed in Version | 4.5.9 revision 43186 | ||||
Summary | 0003485: Manufacturer product count cache is built too long | ||||
Description | In cases when shop has many manufacturers oxUtilsCount::getManufacturerArticleCount() method crashes the shop. This happens due to fact that manufacturer product count cache in the getter is build for EVERY manufacturer and not just for the requested one. | ||||
Tags | Performance | ||||
Theme | Both | ||||
Browser | All | ||||
PHP Version | any | ||||
Database Version | any | ||||
|
Fixed in a way, that only requested manufacturer would be loaded in oxutilscount::setManufacturerArticleCount() method. I include the content of this method here: /** * Saves and returns Manufacturers category article count into cache * * @param array $aCache Category cache data * @param string $sMnfId Unique Manufacturer ident * @param string $sActIdent Unique user context ID * * @return int */ public function setManufacturerArticleCount( $aCache, $sMnfId, $sActIdent ) { // if Manufacturer/category name is 'root', skip counting if ( $sMnfId == 'root' ) { return 0; } $oArticle = oxNew( 'oxarticle' ); $sArtTable = $oArticle->getViewName(); $sManTable = getViewName('oxmanufacturers'); // select each Manufacturer articles count //0003485 //$sQ = "select oxmanufacturers.oxid, count($sArtTable.oxid) from $sManTable as oxmanufacturers left outer join $sArtTable on $sArtTable.oxmanufacturerid=oxmanufacturers.oxid and $sArtTable.oxparentid = '' and ".$oArticle->getSqlActiveSnippet()." group by oxmanufacturers.oxid"; //$sQ = "select oxmanufacturerid, count($sArtTable.oxid) from $sArtTable where $sArtTable.oxparentid = '' and oxmanufacturerid <> '' and ".$oArticle->getSqlActiveSnippet()." group by oxmanufacturerid "; $sQ = "select count($sArtTable.oxid) from $sArtTable where $sArtTable.oxparentid = '' and oxmanufacturerid = '$sMnfId' and ".$oArticle->getSqlActiveSnippet(); $iValue = oxDb::getDb()->getOne( $sQ ); $aCache[$sMnfId][$sActIdent] = (int) $iValue; $this->_setManufacturerCache( $aCache ); return $aCache[$sMnfId][$sActIdent]; } |