Skip to content

Commit

Permalink
Fixing clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
kenza-ya committed Sep 16, 2024
1 parent f037899 commit f7b7d73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Version 26.0.2

## Bugfixes

* Fixing clean-up links if the data in the file is missing, the value is not set to \_\_EMPTY__VALUE__ and the clean-up links configuration is disabled

# Version 26.0.1

## Bugfixes
Expand Down
7 changes: 6 additions & 1 deletion src/Observers/CleanUpLinkObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ protected function process()
// load the row/entity ID of the parent product
$parentId = $this->getLastPrimaryKey();

// remove all the empty values from the row
$row = $this->clearRow();
$this->setRow($row);
// prepare the links for the found link types and clean-up
foreach ($this->linkTypes as $linkTypeCode => $columns) {
// shift the column with the header information from the stack
Expand All @@ -131,11 +134,13 @@ protected function process()
// the clean-up columns functionality in the
// AttributeObserverTrait::clearRow() method has NOT unset the
// column which indicates the column has to be cleaned-up.
if ($this->cleanUpLinks === true || ($this->hasColumn($columnNameChildSkus))) {
if ($this->cleanUpLinks === true || ($this->hasColumn($columnNameChildSkus) && $this->getValue($columnNameChildSkus) === null)) {
// clean-up the links in the database
$this->doCleanUp($parentId, $linkTypeCode, $links);
}
}
// set the origin row again
$this->setRow($this->getSubject()->getRow());
}

/**
Expand Down

0 comments on commit f7b7d73

Please sign in to comment.