protected function setSettings()
    {
        if (empty($this->params['shopgate_settings']) || !is_array($this->params['shopgate_settings'])) {
            throw new ShopgateLibraryException(
                ShopgateLibraryException::PLUGIN_API_NO_SHOPGATE_SETTINGS,
                'Request: ' . var_export($this->params, true)
            );
        }
        // settings that may never be changed:
        $shopgateSettingsBlacklist = array(
            'shop_number',
            'customer_number',
            'apikey',
            'plugin_name',
            'export_folder_path',
            'log_folder_path',
            'cache_folder_path',
            'items_csv_filename',
            'categories_csv_filename',
            'reviews_csv_filename',
            'access_log_filename',
            'error_log_filename',
            'request_log_filename',
            'debug_log_filename',
            'redirect_keyword_cache_filename',
            'redirect_skip_keyword_cache_filename',
        );

        // filter the new settings
        $shopgateSettingsNew = array();
        $shopgateSettingsOld = $this->config->toArray();
        foreach ($this->params['shopgate_settings'] as $setting) {
            if (!isset($setting['name'])) {
                throw new ShopgateLibraryException(
                    ShopgateLibraryException::PLUGIN_API_NO_SHOPGATE_SETTINGS,
                    'Wrong format: ' . var_export($setting, true)
                );
            }

            if (in_array($setting['name'], $shopgateSettingsBlacklist)) {
                continue;
            }

            if (!in_array($setting['name'], array_keys($shopgateSettingsOld))) {
                continue;
            }

            $shopgateSettingsNew[$setting['name']] = isset($setting['value'])
                ? $setting['value']
                : null;
        }

        $this->config->load($shopgateSettingsNew);
        $this->config->save(array_keys($shopgateSettingsNew), true);

        $diff = array();
        foreach ($shopgateSettingsNew as $setting => $value) {
            $diff[] = array('name' => $setting, 'old' => $shopgateSettingsOld[$setting], 'new' => $value);
        }

        // set data and return response
        if (empty($this->response)) {
            $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id);
        }
        $this->responseData['shopgate_settings'] = $diff;
    }