Skip to content

Commit

Permalink
Prevent overwriting of multilang fields in oxshops when no value is p…
Browse files Browse the repository at this point in the history
…resent in yaml
  • Loading branch information
BSOxid committed Sep 18, 2023
1 parent 56ebb0c commit a925bbe
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Core/ConfigImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,20 +244,23 @@ protected function importShopsConfig($aConfigValues)
if ($langId == 0) {
continue;
}
$availableInLangs = $oShop->getAvailableInLangs();
$oShop->setLanguage($langId);
$oShop->loadInLang($langId, $sShopId);
foreach ($aOxShopSettings as $sVarName => $mVarValue) {
$iPosUnderscore = strrpos($sVarName, '_');
if ($iPosUnderscore !== false) {
$sStringAfterUnderscore = substr($sVarName, $iPosUnderscore + 1);
if (is_numeric($sStringAfterUnderscore) && $sStringAfterUnderscore == $langId) {
$sFiledName = substr($sVarName, 0, $iPosUnderscore); // String before last underscore
$aOxShopSettings[$sFiledName] = $mVarValue;
if (isset($availableInLangs[$langId])) {
$oShop->loadInLang($langId, $sShopId);
foreach ($aOxShopSettings as $sVarName => $mVarValue) {
$iPosUnderscore = strrpos($sVarName, '_');
if ($iPosUnderscore !== false) {
$sStringAfterUnderscore = substr($sVarName, $iPosUnderscore + 1);
if (is_numeric($sStringAfterUnderscore) && $sStringAfterUnderscore == $langId) {
$sFiledName = substr($sVarName, 0, $iPosUnderscore); // String before last underscore
$aOxShopSettings[$sFiledName] = $mVarValue;
}
}
}
$oShop->assign($aOxShopSettings);
$oShop->save();
}
$oShop->assign($aOxShopSettings);
$oShop->save();
}
}
}
Expand Down

0 comments on commit a925bbe

Please sign in to comment.