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

Update Save.php #8642

Merged
merged 1 commit into from
Feb 25, 2017
Merged

Update Save.php #8642

merged 1 commit into from
Feb 25, 2017

Conversation

josefbehr
Copy link
Contributor

@josefbehr josefbehr commented Feb 21, 2017

If quantity is changed using mass action for attribute changes, but no stock item exists for the product, saving the newly created stockItem in StockItemRepository->save($stockItem) returns without saving the stockItem, since $stockItem->getProductId() is null, due to it being added to the array with key '0' (see line 165). To fix this, the array key has been changed to "product_id", such that StockItemRepository successfully creates the stockItem.
Also, in my opinion, StockItemRepository->save() should not just return without notice, especially as it already encapsulates the functionality in a try/catch block. Throwing an exception would actually tell the user that something went wrong.

If quantity is changed using mass action for attribute changes, but no stock item exists for the product, saving the newly created stockItem in StockItemRepository->save($stockItem) returns without saving the stockItem, since $stockItem->getProductId() is null, due to it being added to the array with key '0' (see line 165). To fix this, the array key has been changed to "product_id", such that StockItemRepository successfully creates the stockItem.
Also, in my opinion, StockItemRepository->save() should not just return without notice, especially as it already encapsulates the functionality in a try/catch block. Throwing an exception would actually tell the user that something went wrong.
@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Feb 21, 2017

CLA assistant check
All committers have signed the CLA.

@maghamed maghamed self-requested a review February 21, 2017 16:42
@maghamed maghamed self-assigned this Feb 21, 2017
@@ -162,7 +162,7 @@ public function execute()
$this->attributeHelper->getStoreWebsiteId($storeId)
);
if (!$stockItemDo->getProductId()) {
$inventoryData[] = $productId;
$inventoryData['product_id'] = $productId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, looks like it never worked:

@maghamed maghamed added this to the February 2017 milestone Feb 22, 2017
@okorshenko okorshenko self-assigned this Feb 24, 2017
@mmansoor-magento mmansoor-magento merged commit 8a0f0c6 into magento:develop Feb 25, 2017
@okorshenko
Copy link
Contributor

@josefbehr thank you for your contribution!
@orlangur thank you for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants