source/Core/SeoEncoder.php
protected function _getUniqueSeoUrl($sSeoUrl, $sObjectId = null, $iObjectLang = null)
    {
        $sSeoUrl = $this->_prepareUri($sSeoUrl, $iObjectLang);
        $oStr = getStr();
        $sExt = '';
        if ($oStr->preg_match('/(\.html?|\/)$/i', $sSeoUrl, $aMatched)) {
            $sExt = $aMatched[0];
        }
        $sBaseSeoUrl = $sSeoUrl;
        if ($sExt && $oStr->substr($sSeoUrl, 0 - $oStr->strlen($sExt)) == $sExt) {
            $sBaseSeoUrl = $oStr->substr($sSeoUrl, 0, $oStr->strlen($sSeoUrl) - $oStr->strlen($sExt));
        }

        $iShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
        $iCnt = 0;
        $sCheckSeoUrl = $this->_trimUrl($sSeoUrl);
        $sQ = "select 1 from oxseo where oxshopid = '{$iShopId}'";

        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        // skipping self
        if ($sObjectId && isset($iObjectLang)) {
            $iObjectLang = (int) $iObjectLang;
            $sQ .= " and not (oxobjectid = " . $oDb->quote($sObjectId) . " and oxlang = $iObjectLang)";
        }

        while ($oDb->getOne($sQ . " and oxident= " . $oDb->quote($this->_getSeoIdent($sCheckSeoUrl)))) {
            $sAdd = '';
            if (self::$_sPrefix) {
                $sAdd = self::$_sSeparator . self::$_sPrefix;
            }
            if ($iCnt) {
                $sAdd .= self::$_sSeparator . $iCnt;
            }
            ++$iCnt;

            $sSeoUrl = $sBaseSeoUrl . $sAdd . $sExt;
            $sCheckSeoUrl = $this->_trimUrl($sSeoUrl);
        }

        return $sSeoUrl;
    }
protected function _getUniqueSeoUrl($sSeoUrl, $sObjectId = null, $iObjectLang = null)
    {
        $sSeoUrl = $this->_prepareUri($sSeoUrl, $iObjectLang);
        $oStr = getStr();
        $sExt = '';
        if ($oStr->preg_match('/(\.html?|\/)$/i', $sSeoUrl, $aMatched)) {
            $sExt = $aMatched[0];
        }
        $sBaseSeoUrl = $sSeoUrl;
        if ($sExt && $oStr->substr($sSeoUrl, 0 - $oStr->strlen($sExt)) == $sExt) {
            $sBaseSeoUrl = $oStr->substr($sSeoUrl, 0, $oStr->strlen($sSeoUrl) - $oStr->strlen($sExt));
        }

        $iShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
        $iCnt = 0;
        $sCheckSeoUrl = $this->_trimUrl($sSeoUrl);
        $sQ = "select 1 from oxseo where oxshopid = '{$iShopId}'";

        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        // skipping self
        if ($sObjectId && isset($iObjectLang)) {
            $iObjectLang = (int) $iObjectLang;
            $sQ .= " and not (oxobjectid = " . $oDb->quote($sObjectId) . " and oxlang = $iObjectLang)";
        }

        while ($oDb->getOne($sQ . " and oxident= " . $oDb->quote($this->_getSeoIdent($sCheckSeoUrl)))) {
            $sAdd = '';
            if (self::$_sPrefix) {
                $sAdd = self::$_sSeparator . self::$_sPrefix;
            }
            if ($iCnt) {
                $sAdd .= self::$_sSeparator . $iCnt;
            }
            ++$iCnt;

            $sSeoUrl = $sBaseSeoUrl . $sAdd . $sExt;
            $sCheckSeoUrl = $this->_trimUrl($sSeoUrl);
        }

        return $sSeoUrl;
    }
protected function _getUniqueSeoUrl ( $ sSeoUrl , $ sObjectId = null , $ iObjectLang = null ) { $ sSeoUrl = $ this -> _prepareUri ( $ sSeoUrl , $ iObjectLang ) ; $ oStr = getStr ( ) ; $ sExt = '' ; if ( $ oStr -> preg_match ( '/(\.html?|\/)$/i' , $ sSeoUrl , $ aMatched ) ) { $ sExt = $ aMatched [ 0 ] ; } $ sBaseSeoUrl = $ sSeoUrl ; if ( $ sExt && $ oStr -> substr ( $ sSeoUrl , 0 - $ oStr -> strlen ( $ sExt ) ) == $ sExt ) { $ sBaseSeoUrl = $ oStr -> substr ( $ sSeoUrl , 0 , $ oStr -> strlen ( $ sSeoUrl ) - $ oStr -> strlen ( $ sExt ) ) ; } $ iShopId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) ; $ iCnt = 0 ; $ sCheckSeoUrl = $ this -> _trimUrl ( $ sSeoUrl ) ; $ sQ = "select 1 from oxseo where oxshopid = '{$iShopId}'" ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; // skipping self if ( $ sObjectId && isset ( $ iObjectLang ) ) { $ iObjectLang = ( int ) $ iObjectLang ; $ sQ .= " and not (oxobjectid = " . $ oDb -> quote ( $ sObjectId ) . " and oxlang = $iObjectLang)" ; } while ( $ oDb -> getOne ( $ sQ . " and oxident= " . $ oDb -> quote ( $ this -> _getSeoIdent ( $ sCheckSeoUrl ) ) ) ) { $ sAdd = '' ; if ( self :: $ _sPrefix ) { $ sAdd = self :: $ _sSeparator . self :: $ _sPrefix ; } if ( $ iCnt ) { $ sAdd .= self :: $ _sSeparator . $ iCnt ; } ++ $ iCnt ; $ sSeoUrl = $ sBaseSeoUrl . $ sAdd . $ sExt ; $ sCheckSeoUrl = $ this -> _trimUrl ( $ sSeoUrl ) ; } return $ sSeoUrl ; }
_getUniqueSeoUrl returns possibly modified url
for not to be same as already existing in db

@param string $sSeoUrl     seo url
@param string $sObjectId   current object id, used to skip self in query
@param int    $iObjectLang object language id

@access protected

@return string
_getUniqueSeoUrl returns possibly modified url for not to be same as already existing in db