protected function _getCookieUserId()
    {
        $sUserID = null;
        $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $sShopID = $oConfig->getShopId();
        if (($sSet = Registry::getUtilsServer()->getUserCookie($sShopID))) {
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            $aData = explode('@@@', $sSet);
            $sUser = $aData[0];
            $sPWD = @$aData[1];

            $sSelect = $this->formUserCookieQuery($sUser, $sShopID);
            $rs = $oDb->select($sSelect);
            if ($rs != false && $rs->count() > 0) {
                while (!$rs->EOF) {
                    $sTest = crypt($rs->fields[1], static::USER_COOKIE_SALT);
                    if ($sTest == $sPWD) {
                        // found
                        $sUserID = $rs->fields[0];
                        break;
                    }
                    $rs->fetchRow();
                }
            }
            // if cookie info is not valid, remove it.
            if (!$sUserID) {
                Registry::getUtilsServer()->deleteUserCookie($sShopID);
            }
        }

        return $sUserID;
    }