public function saveShopConfVar($varType, $varName, $varVal, $shopId = null, $module = '')
    {
        switch ($varType) {
            case 'arr':
            case 'aarr':
                $value = serialize($varVal);
                break;
            case 'bool':
                //config param
                $varVal = (($varVal == 'true' || $varVal) && $varVal && strcasecmp($varVal, "false"));
                //db value
                $value = $varVal ? "1" : "";
                break;
            case 'num':
                //config param
                $varVal = $varVal != '' ? Registry::getUtils()->string2Float($varVal) : '';
                $value = $varVal;
                break;
            default:
                $value = $varVal;
                break;
        }

        if (!$shopId) {
            $shopId = $this->getShopId();
        }

        // Update value only for current shop
        if ($shopId == $this->getShopId()) {
            $this->setConfigParam($varName, $varVal);
        }

        $db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $shopIdQuoted = $db->quote($shopId);
        $moduleQuoted = $db->quote($module);
        $varNameQuoted = $db->quote($varName);
        $varTypeQuoted = $db->quote($varType);
        $varValueQuoted = $db->quote($value);
        $configKeyQuoted = $db->quote($this->getConfigParam('sConfigKey'));
        $newOXIDdQuoted = $db->quote(\OxidEsales\Eshop\Core\Registry::getUtilsObject()->generateUID());

        $query = "delete from oxconfig where oxshopid = $shopIdQuoted and oxvarname = $varNameQuoted and oxmodule = $moduleQuoted";
        $db->execute($query);

        $query = "insert into oxconfig (oxid, oxshopid, oxmodule, oxvarname, oxvartype, oxvarvalue)
               values($newOXIDdQuoted, $shopIdQuoted, $moduleQuoted, $varNameQuoted, $varTypeQuoted, ENCODE( $varValueQuoted, $configKeyQuoted) )";
        $db->execute($query);

        $this->informServicesAfterConfigurationChanged($varName, $shopId, $module);
    }