60 if ( isset( $this->_aCatCache[$sCacheId] ) ) {
61 $sSeoUrl = $this->_aCatCache[ $sCacheId ];
62 } elseif ( ( $sSeoUrl = $this->
_loadFromDb(
'oxcategory', $oCat->getId(), $iLang ) ) ) {
64 $this->_aCatCache[ $sCacheId ] = $sSeoUrl;
82 return $oCat->getId() .
'_' . ( (int) $iLang );
94 public function getCategoryUri( $oCat, $iLang = null, $blRegenerate =
false )
96 startProfile(__FUNCTION__);
97 $sCatId = $oCat->getId();
100 if ( $oCat->oxcategories__oxextlink->value ) {
104 if (!isset($iLang)) {
105 $iLang = $oCat->getLanguage();
108 $aCacheMap = array();
109 $aStdLinks = array();
113 if ($iLang != $oCat->getLanguage()) {
114 $sId = $oCat->getId();
115 $oCat =
oxNew(
'oxcategory');
116 $oCat->loadInLang($iLang, $sId);
120 $sTitle = $this->
_prepareTitle( $oCat->oxcategories__oxtitle->value,
false, $oCat->getLanguage() );
122 foreach ( array_keys( $aCacheMap ) as $id ) {
123 $aCacheMap[$id] = $sTitle .
'/' . $aCacheMap[$id];
126 $aCacheMap[$oCat->getId()] = $sTitle;
127 $aStdLinks[$oCat->getId()] = $oCat->getBaseStdLink($iLang);
130 $oCat = $oCat->getParentCategory();
133 foreach ( $aCacheMap as $sId => $sUri ) {
134 $this->_aCatCache[$sId.
'_'.$iLang] = $this->
_processSeoUrl( $sSeoUrl.$sUri.
'/', $sId, $iLang );
135 $this->
_saveToDb(
'oxcategory', $sId, $aStdLinks[$sId], $this->_aCatCache[$sId.
'_'.$iLang], $iLang );
138 $sSeoUrl = $this->_aCatCache[$sCatId.
'_'.$iLang];
141 stopProfile(__FUNCTION__);
159 if (!isset($iLang)) {
160 $iLang = $oCategory->getLanguage();
162 $sStdUrl = $oCategory->getBaseStdLink($iLang) .
'&pgNr=' . $iPage;
163 $sParams = (int) ($iPage + 1);
165 $sStdUrl = $this->
_trimUrl( $sStdUrl, $iLang );
166 $sSeoUrl = $this->
getCategoryUri( $oCategory, $iLang ) . $sParams .
"/";
168 if ( $blFixed === null ) {
169 $blFixed = $this->
_isFixed(
'oxcategory', $oCategory->getId(), $iLang );
171 return $this->
_getFullUrl( $this->
_getPageUri( $oCategory,
'oxcategory', $sStdUrl, $sSeoUrl, $sParams, $iLang, $blFixed ), $iLang );
188 if (!isset($iLang)) {
189 $iLang = $oCategory->getLanguage();
192 if ( ( $sSeoUrl = $this->
getCategoryUri( $oCategory, $iLang ) ) ) {
208 $sIdQuoted = $oDb->quote($oCategory->getId());
213 $aCatInfo = $oDb->getAll(
"select oxrootid, oxleft, oxright from oxcategories where oxid = $sIdQuoted limit 1");
214 $sCatRootIdQuoted = $oDb->quote( $aCatInfo[0][0] );
217 $sQ =
"update oxseo as seo1, (select oxid from oxcategories where oxrootid={$sCatRootIdQuoted} and oxleft > ".((int) $aCatInfo[0][1] ).
" and oxright < ".((int) $aCatInfo[0][2] ).
") as seo2 set seo1.oxexpired = '1' where seo1.oxtype = 'oxcategory' and seo1.oxobjectid = seo2.oxid";
218 $oDb->execute( $sQ );
221 $sQ =
"update oxseo as seo1, (select o2c.oxobjectid as id from oxcategories as cat left join oxobject2category"
222 .
" as o2c on o2c.oxcatnid=cat.oxid where cat.oxrootid={$sCatRootIdQuoted} and cat.oxleft >= "
223 .((int) $aCatInfo[0][1] ).
" and cat.oxright <= ".((int) $aCatInfo[0][2] ).
") as seo2 "
224 .
"set seo1.oxexpired = '1' where seo1.oxtype = 'oxarticle' and seo1.oxobjectid = seo2.id "
225 .
"and seo1.oxfixed = 0";
227 $oDb->execute( $sQ );
241 $sIdQuoted = $oDb->quote($oCategory->getId());
242 $oDb->execute(
"update oxseo, (select oxseourl from oxseo where oxobjectid = $sIdQuoted and oxtype = 'oxcategory') as test set oxseo.oxexpired=1 where oxseo.oxseourl like concat(test.oxseourl, '%') and (oxtype = 'oxcategory' or oxtype = 'oxarticle')");
243 $oDb->execute(
"delete from oxseo where oxseo.oxtype = 'oxarticle' and oxseo.oxparams = $sIdQuoted" );
244 $oDb->execute(
"delete from oxseo where oxobjectid = $sIdQuoted and oxtype = 'oxcategory'");
245 $oDb->execute(
"delete from oxobject2seodata where oxobjectid = $sIdQuoted");
259 $oCat =
oxNew(
"oxcategory" );
260 if ( $oCat->loadInLang( $iLang, $sObjectId ) ) {