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

Commit f0076db

Browse files
Merge pull request #54 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 dd0036b + c5eef4d commit f0076db

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

Core/ConfigImport.php

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -244,29 +244,34 @@ protected function importShopsConfig($aConfigValues)
244244
if ($langId == 0) {
245245
continue;
246246
}
247+
$availableInLangs = $oShop->getAvailableInLangs();
247248
$viewNameGenerator = oxNew(\OxidEsales\Eshop\Core\TableViewNameGenerator::class);
248249
$viewName = $viewNameGenerator->getViewName('oxshops', $langId);
250+
substr($viewName, 12);
249251
$oShop->setLanguage($langId);
250-
if (!is_numeric(substr($viewName, 12))) {
251-
$oShop->loadInLang($langId, $sShopId);
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;
252+
if (isset($availableInLangs[$langId])) {
253+
if (!is_numeric(substr($viewName, 12))) {
254+
$oShop->loadInLang($langId, $sShopId);
255+
}
256+
foreach ($aOxShopSettings as $sVarName => $mVarValue) {
257+
$iPosUnderscore = strrpos($sVarName, '_');
258+
if ($iPosUnderscore !== false) {
259+
$sStringAfterUnderscore = substr($sVarName, $iPosUnderscore + 1);
260+
if (is_numeric($sStringAfterUnderscore) && $sStringAfterUnderscore == $langId) {
261+
$sFiledName = substr($sVarName, 0, $iPosUnderscore); // String before last underscore
262+
$aOxShopSettings[$sFiledName] = $mVarValue;
263+
}
260264
}
261265
}
266+
$oShop->assign($aOxShopSettings);
267+
$oShop->save();
262268
}
263-
$oShop->assign($aOxShopSettings);
264-
$oShop->save();
265269
}
266270
}
267271
}
268272
}
269273

274+
270275
/**
271276
* Create new sub-shop through config file
272277
*

0 commit comments

Comments
 (0)