diff --git a/src/MetaModels/MetaModel.php b/src/MetaModels/MetaModel.php index 4ef5772a8..5e9e28a3b 100644 --- a/src/MetaModels/MetaModel.php +++ b/src/MetaModels/MetaModel.php @@ -922,6 +922,14 @@ protected function updateVariants($item, $activeLanguage, $allIds) } $this->saveAttribute($objAttribute, $arrIds, $item->get($strAttributeId), $activeLanguage); } + + // Run each id and trigger the model saved function. + foreach($allIds as $id){ + $variantItem = $this->findById($id); + foreach ($this->getAttributes() as $strAttributeId => $objAttribute) { + $objAttribute->modelSaved($variantItem); + } + } } /** @@ -1000,14 +1008,15 @@ public function saveItem($objItem) } } - $this->updateVariants($objItem, $strActiveLanguage, $arrAllIds); - // Tell all attributes that the model has been saved. Useful for alias fields, edit counters etc. foreach ($this->getAttributes() as $objAttribute) { if ($objItem->isAttributeSet($objAttribute->getColName())) { $objAttribute->modelSaved($objItem); } } + + // Update all variants. + $this->updateVariants($objItem, $strActiveLanguage, $arrAllIds); } /**