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

Commit fca52b7

Browse files
Merge pull request #52 from OXIDprojects/fix-overwriting-multilang-strings-in-oxshops-when-not-present-in-yaml
Prevent overwriting of multilang fields in oxshops when no value is p…
2 parents b7847d9 + a925bbe commit fca52b7

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

Core/ConfigImport.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -244,20 +244,23 @@ protected function importShopsConfig($aConfigValues)
244244
if ($langId == 0) {
245245
continue;
246246
}
247+
$availableInLangs = $oShop->getAvailableInLangs();
247248
$oShop->setLanguage($langId);
248-
$oShop->loadInLang($langId, $sShopId);
249-
foreach ($aOxShopSettings as $sVarName => $mVarValue) {
250-
$iPosUnderscore = strrpos($sVarName, '_');
251-
if ($iPosUnderscore !== false) {
252-
$sStringAfterUnderscore = substr($sVarName, $iPosUnderscore + 1);
253-
if (is_numeric($sStringAfterUnderscore) && $sStringAfterUnderscore == $langId) {
254-
$sFiledName = substr($sVarName, 0, $iPosUnderscore); // String before last underscore
255-
$aOxShopSettings[$sFiledName] = $mVarValue;
249+
if (isset($availableInLangs[$langId])) {
250+
$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+
}
256259
}
257260
}
261+
$oShop->assign($aOxShopSettings);
262+
$oShop->save();
258263
}
259-
$oShop->assign($aOxShopSettings);
260-
$oShop->save();
261264
}
262265
}
263266
}

0 commit comments

Comments
 (0)