From a72823141fcec088ed4bd582b6c8561509e430a5 Mon Sep 17 00:00:00 2001 From: Iwona Just Date: Fri, 17 Nov 2023 13:15:43 +0000 Subject: [PATCH] order of events for setting enabled & enabledForSite --- src/services/Process.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/services/Process.php b/src/services/Process.php index bb86ab72..0ddd4b7c 100644 --- a/src/services/Process.php +++ b/src/services/Process.php @@ -369,9 +369,6 @@ public function processFeed($step, $feed, &$processedElementIds, $feedData = nul } } - // Set the attributes for the element - $element->setAttributes($attributeData, false); - $contentData = []; if (isset($attributeData['enabled'])) { // Set the site-specific status as well, but retain all other site statuses @@ -390,8 +387,13 @@ public function processFeed($step, $feed, &$processedElementIds, $feedData = nul $element->setEnabledForSite($enabledForSite); $contentData['enabled'] = $element->enabled; $contentData['enabledForSite'] = $element->getEnabledForSite($element->siteId); + + unset($attributeData['enabled']); } + // Set the attributes for the element + $element->setAttributes($attributeData, false); + // Then, do the same for custom fields. Again, this should be done after populating the element attributes foreach ($feed['fieldMapping'] as $fieldHandle => $fieldInfo) { if (Hash::get($fieldInfo, 'field')) {