View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004555 | OXID eShop (all versions) | 1.01. Products (product, categories, manufacturer, promotions etc.) | public | 2012-09-25 09:51 | 2012-12-07 14:10 |
Reporter | avenger | Assigned To | |||
Priority | high | Severity | major | Reproducibility | always |
Status | resolved | Resolution | no change required | ||
Summary | 0004555: Wrong interpretation of "$aSessionFilter" in filter SQL buiding | ||||
Description | In "alist" public function executefilter() { $iLang = oxLang::getInstance()->getBaseLanguage(); // store this into session $aFilter = oxConfig::getParameter( 'attrfilter', 1 ); $sActCat = oxConfig::getParameter( 'cnid' ); if ( !empty( $aFilter ) ) { $aSessionFilter = oxSession::getVar( 'session_attrfilter' ); //fix for 0002904 - if language will be changed attributes of this category will be deleted from session //and new filters for active language set. $aSessionFilter[$sActCat] = null; $aSessionFilter[$sActCat][$iLang] = $aFilter; oxSession::setVar( 'session_attrfilter', $aSessionFilter ); } } "$aSessionFilter" receives a new dimension "$iLang".... So it's structure is $aSessionFilter: array ( catid => array($iLang => array( attrid => value,...))) In "alist" protected function _loadArticles( $oCategory ) { .......... $aSessionFilter = oxSession::getVar( 'session_attrfilter' ); $sActCat = oxConfig::getParameter( 'cnid' ); $this->_iAllArtCnt = $oArtList->loadCategoryArticles( $sActCat, $aSessionFilter ); .......... } "$aSessionFilter" is the retrieved with this new structure But all(!) subsequent uses of it still assume the old structure!!! E.g.: * @param array $aSessionFilter Like array ( catid => array( attrid => value,...)) * * @return string SQL */ protected function _getCategorySelect( $sFields, &$sCatId, $aSessionFilter ) { So the SQL-criteria built for filter selections are dead wrong! | ||||
Additional Information | Solution: Change "protected function _loadArticles( $oCategory )" in "alist.php" to eliminate the language dimension: protected function _loadArticles( $oCategory ) { $myConfig = $this->getConfig(); $iNrofCatArticles = (int) $myConfig->getConfigParam( 'iNrofCatArticles' ); $iNrofCatArticles = $iNrofCatArticles?$iNrofCatArticles:1; // load only articles which we show on screen $oArtList = oxNew( 'oxarticlelist' ); $oArtList->setSqlLimit( $iNrofCatArticles * $this->_getRequestPageNr(), $iNrofCatArticles ); $oArtList->setCustomSorting( $this->getSortingSql( $oCategory->getId() ) ); if ( $oCategory->isPriceCategory() ) { $dPriceFrom = $oCategory->oxcategories__oxpricefrom->value; $dPriceTo = $oCategory->oxcategories__oxpriceto->value; $this->_iAllArtCnt = $oArtList->loadPriceArticles( $dPriceFrom, $dPriceTo, $oCategory ); } else { $aSessionFilter = oxSession::getVar( 'session_attrfilter' ); //Avenger //Eliminate language dimension from filters $iLang = oxLang::getInstance()->getBaseLanguage(); $sCategoryId=$oCategory->getId(); $aSessionFilter[$sCategoryId]=$aSessionFilter[$sCategoryId][$iLang]; //Avenger $sActCat = oxConfig::getParameter( 'cnid' ); $this->_iAllArtCnt = $oArtList->loadCategoryArticles( $sActCat, $aSessionFilter ); } $this->_iCntPages = round( $this->_iAllArtCnt/$iNrofCatArticles + 0.49 ); return $oArtList; } | ||||
Tags | Attributes | ||||
Theme | Both | ||||
Browser | All | ||||
PHP Version | any | ||||
Database Version | any | ||||
|
@avenger: Language dimension is already stripped along with category dimension in oxarticlelist::_getCategorySelect: // ---------------------------------- // filtering ? $sFilterSql = ''; $iLang = oxLang::getInstance()->getBaseLanguage(); if ( $aSessionFilter && isset( $aSessionFilter[$sCatId][$iLang] ) ) { $sFilterSql = $this->_getFilterSql($sCatId, $aSessionFilter[$sCatId][$iLang]); } |
|
attribute filter management is ok |