Skip to content

Commit

Permalink
Merge pull request #11876 from Dan-Orchard/develop
Browse files Browse the repository at this point in the history
CO: Fix lang table multi-store data issue
  • Loading branch information
Quetzacoalt91 committed Dec 21, 2018
2 parents cbe2204 + dc6ed1c commit d8f3e85
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions classes/ObjectModel.php
Expand Up @@ -537,6 +537,8 @@ public function add($auto_date = true, $null_values = false)
$this->date_upd = date('Y-m-d H:i:s');
}

$id_shop_list = Shop::getCompleteListOfShopsID();

if (Shop::isTableAssociated($this->def['table'])) {
$id_shop_list = Shop::getContextListShopID();
if (count($this->id_shop_list)) {
Expand Down Expand Up @@ -574,7 +576,6 @@ public function add($auto_date = true, $null_values = false)
if (!empty($this->def['multilang'])) {
$fields = $this->getFieldsLang();
if ($fields && is_array($fields)) {
$shops = Shop::getCompleteListOfShopsID();
$asso = Shop::getAssoTable($this->def['table'] . '_lang');
foreach ($fields as $field) {
foreach (array_keys($field) as $key) {
Expand All @@ -585,7 +586,7 @@ public function add($auto_date = true, $null_values = false)
$field[$this->def['primary']] = (int) $this->id;

if ($asso !== false && $asso['type'] == 'fk_shop') {
foreach ($shops as $id_shop) {
foreach ($id_shop_list as $id_shop) {
$field['id_shop'] = (int) $id_shop;
$result &= Db::getInstance()->insert($this->def['table'] . '_lang', $field);
}
Expand Down

0 comments on commit d8f3e85

Please sign in to comment.