Skip to content

Commit

Permalink
Merge pull request #7 from Agence-DnD/hotfix/attribute_code
Browse files Browse the repository at this point in the history
Force attribute_code to be lowercase
  • Loading branch information
Dnd-Gimix authored Feb 21, 2019
2 parents e6dd7ef + 27c35f7 commit ba1159a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# PIMGento API change Log

### 100.1.1 :
Fix price set to 0 if attribute price is empty

Fix media import with wrong entity_type_id
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ Contributing policy

**You can not commit directly on this repository.**

Fork the project, create a feature branch, and send a pull request.
Fork the project, create a feature branch, and send a pull request on the develop branch.

2 changes: 2 additions & 0 deletions app/code/community/Pimgento/Api/Helper/Product.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ private function formatAssociations(stdClass $associations, array $values)
*/
private function getKey($attribute, array $specifics)
{
/** @var string $attribute */
$attribute = strtolower($attribute);
if (isset($specifics['locale']) && isset($specifics['scope'])) {
return sprintf('%s-%s-%s', $attribute, $specifics['locale'], $specifics['scope']);
}
Expand Down
6 changes: 3 additions & 3 deletions app/code/community/Pimgento/Api/Model/Job/Attribute.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function insertData($task)
*/
foreach ($attributes as $index => $attribute) {
/** @var string $attributeCode */
$attributeCode = $attribute['code'];
$attributeCode = strtolower($attribute['code']);
/** @var int $id */
if ($attributeHelper->isAttributeCodeReserved($attributeCode)) {
if (!$isPrefixEnabled) {
Expand All @@ -107,9 +107,9 @@ public function insertData($task)

continue;
}

$attribute['code'] = Pimgento_Api_Helper_Attribute::RESERVED_ATTRIBUTE_CODE_PREFIX . $attributeCode;
$attributeCode = Pimgento_Api_Helper_Attribute::RESERVED_ATTRIBUTE_CODE_PREFIX . $attributeCode;
}
$attribute['code'] = $attributeCode;
/** @var string[] $columns */
$columns = $entitiesHelper->getColumnsFromResult($attribute);
/** @var bool $result */
Expand Down

0 comments on commit ba1159a

Please sign in to comment.