/** * reverseSortingMapping * * map sorting by FACT-Finder (sortSORTVALUE => DIRECTION) * to oxid sorting ('listorder' => DIRECTION and 'listorderby' => SORTVALUE) * * @param Parameters $serverParameters * @return Parameters */ protected function reverseSortingMapping($serverParameters) { $oConfig = class_exists('oxRegistry') ? \oxRegistry::getConfig() : \oxConfig::getInstance(); if ($oConfig->getConfigParam('bSwFFUseSortings')) { foreach ($serverParameters->getArray() as $name => $value) { if (strpos($name, 'sort') !== 0) { continue; } $serverParameters['listorder'] = $value; $serverParameters['listorderby'] = substr($name, 4); unset($serverParameters[$name]); } } else { $aMapping = $oConfig->getConfigParam('aSwFFSortMapping'); foreach ($aMapping as $oxidValue => $FFParamSuffix) { $FFParamName = 'sort' . $FFParamSuffix; if (!isset($serverParameters[$FFParamName])) { continue; } $serverParameters['listorder'] = $serverParameters[$FFParamName]; $serverParameters['listorderby'] = $oxidValue; unset($serverParameters[$FFParamName]); } } }