Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Commit 48d5895

Browse files
committed
Prevent overwriting of multilang fields in oxshops when no value is present in yaml
1 parent a925bbe commit 48d5895

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

Core/ConfigImport.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -244,23 +244,24 @@ protected function importShopsConfig($aConfigValues)
244244
if ($langId == 0) {
245245
continue;
246246
}
247-
$availableInLangs = $oShop->getAvailableInLangs();
247+
$viewNameGenerator = oxNew(\OxidEsales\Eshop\Core\TableViewNameGenerator::class);
248+
$viewName = $viewNameGenerator->getViewName('oxshops', $langId);
248249
$oShop->setLanguage($langId);
249-
if (isset($availableInLangs[$langId])) {
250+
if (!is_numeric(substr($viewName, 12))) {
250251
$oShop->loadInLang($langId, $sShopId);
251-
foreach ($aOxShopSettings as $sVarName => $mVarValue) {
252-
$iPosUnderscore = strrpos($sVarName, '_');
253-
if ($iPosUnderscore !== false) {
254-
$sStringAfterUnderscore = substr($sVarName, $iPosUnderscore + 1);
255-
if (is_numeric($sStringAfterUnderscore) && $sStringAfterUnderscore == $langId) {
256-
$sFiledName = substr($sVarName, 0, $iPosUnderscore); // String before last underscore
257-
$aOxShopSettings[$sFiledName] = $mVarValue;
258-
}
252+
}
253+
foreach ($aOxShopSettings as $sVarName => $mVarValue) {
254+
$iPosUnderscore = strrpos($sVarName, '_');
255+
if ($iPosUnderscore !== false) {
256+
$sStringAfterUnderscore = substr($sVarName, $iPosUnderscore + 1);
257+
if (is_numeric($sStringAfterUnderscore) && $sStringAfterUnderscore == $langId) {
258+
$sFiledName = substr($sVarName, 0, $iPosUnderscore); // String before last underscore
259+
$aOxShopSettings[$sFiledName] = $mVarValue;
259260
}
260261
}
261-
$oShop->assign($aOxShopSettings);
262-
$oShop->save();
263262
}
263+
$oShop->assign($aOxShopSettings);
264+
$oShop->save();
264265
}
265266
}
266267
}

0 commit comments

Comments
 (0)