// make sure that no expired article-seourl is returned // if no actual seo url is found in oxseo, load article and getMainLink (more expensive, but on the very next call there will be an actual oxseo-entry) protected function _getSeoUrl($sObjectId, $iLang, $iShopId) { $oDb = oxDb::getDb(true); $aInfo = $oDb->getRow( "select oxseourl, oxtype from oxseo where oxobjectid = " . $oDb->quote( $sObjectId ) . " and oxlang = " . $oDb->quote( $iLang ) . " and oxshopid = " . $oDb->quote( $iShopId ) . " order by oxparams limit 1" ); if ('oxarticle' == $aInfo['oxtype']) { $sMainCatId = $oDb->getOne( "select oxcatnid from ".getViewName( "oxobject2category" )." where oxobjectid = " . $oDb->quote( $sObjectId ) . " order by oxtime" ); if ($sMainCatId) { $sUrl = $oDb->getOne( "select oxseourl from oxseo where oxobjectid = " . $oDb->quote( $sObjectId ) . " and oxlang = " . $oDb->quote( $iLang ) . " and oxshopid = " . $oDb->quote( $iShopId ) . " and oxparams = " . $oDb->quote( $sMainCatId ) . " and oxexpired=0" ); //<-- new "and oxexpired=0" if ($sUrl) { return $sUrl; } } // new --> $oArticle = oxNew( "oxarticle" ); $oArticle->setSkipAssign(true); $oArticle->load($sObjectId); $sSeoUrl = $oArticle->getMainLink($iLang); $oStr = getStr(); $sBaseUrl = $this->getConfig()->getShopURL(); if ( $oStr->strpos( $sSeoUrl, $sBaseUrl ) === 0 ) { $sSeoUrl = $oStr->substr( $sSeoUrl, $oStr->strlen( $sBaseUrl ) ); } return $sSeoUrl; // <-- } return $aInfo['oxseourl']; }