protected function CleanupAffiliateCode($sAffiliateCode)
    {
        $sRet = '';
        $sAffiliateCode = trim($sAffiliateCode);
        if (!empty($sAffiliateCode)) {
            //get all rating services
            $sQuery = "  SELECT *
                       FROM `pkg_shop_rating_service`
                      WHERE `active` = '1'
                   ORDER BY `position`,`weight`  ASC
                  ";
            $oRatingServiceList = TdbPkgShopRatingServiceList::GetList($sQuery);
            $oRatingServiceList->GoToStart();

            //loop and try to identify one...
            while ($oService = $oRatingServiceList->Next()) {
                /* @var $oService TdbPkgShopRatingService */
                $pos = strpos($sAffiliateCode, strtolower(trim($oService->fieldAffiliateValue)));
                if (false !== $pos) {
                    //service found!
                    $oRatingServiceList->GoToEnd();
                    $sRet = $oService->fieldAffiliateValue;
                }
            }
        }

        return $sRet;
    }