Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions app/code/community/Pimgento/Api/Helper/Entities.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,27 @@ public function getColumnsFromResult(array $result)

return (array)$columns;
}

/**
* Set key to lower case
* to avoid problems with values import
*
* @param string $key
*
* @return string
*/
public function keyToLowerCase($key)
{
/** @var string[] $keyParts */
$keyParts = explode('-', $key, 2);
$keyParts[0] = strtolower($keyParts[0]);
/** @var string $newKey */
if (count($keyParts) > 1) {
$newKey = $keyParts[0].'-'.$keyParts[1];
} else {
$newKey = $keyParts[0];
}

return $newKey;
}
}
1 change: 1 addition & 0 deletions app/code/community/Pimgento/Api/Helper/Family/Variant.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function getColumnsFromResult(array $result)
* @var mixed $value
*/
foreach ($result as $key => $value) {
$key = $this->keyToLowerCase($key);
if (in_array($key, static::EXCLUDED_COLUMNS)) {
continue;
}
Expand Down
1 change: 1 addition & 0 deletions app/code/community/Pimgento/Api/Helper/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function getColumnsFromResult(array $result)
* @var mixed $value
*/
foreach ($result as $key => $value) {
$key = $this->keyToLowerCase($key);
if (in_array($key, static::EXCLUDED_COLUMNS)) {
continue;
}
Expand Down