Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force attribute_code to be lowercase #7

Merged
merged 4 commits into from
Feb 21, 2019
Merged
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
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