-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Tiered pricing and quantity Increments do not work with decimal inventory MAGETWO-86164 (both front-end and back-end) #13359
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
Conversation
Please, fix the failed tests. Thanks |
Vasilii Burlacu seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
f777c86
to
0671a8c
Compare
@rogyar Could you please advice on the only remaining failed test ? It says to reduce |
As an option, you can add the stockItemRepository to the helper class ( |
Hi @rogyar , can you please advice on the latest failed test ? I see failed tests has nothing related to the work I've done in scope of this PR. Should I still fix them ? Thank you! |
I'm following this thread, having same issue with one of our clients. |
app/code/Magento/CatalogInventory/Helper/ProductStockIsQtyDecimal.php
Outdated
Show resolved
Hide resolved
app/code/Magento/CatalogInventory/Helper/ProductStockIsQtyDecimal.php
Outdated
Show resolved
Hide resolved
app/code/Magento/CatalogInventory/Helper/ProductStockIsQtyDecimal.php
Outdated
Show resolved
Hide resolved
app/code/Magento/CatalogInventory/Helper/ProductStockIsQtyDecimal.php
Outdated
Show resolved
Hide resolved
app/code/Magento/CatalogInventory/Helper/ProductStockIsQtyDecimal.php
Outdated
Show resolved
Hide resolved
app/code/Magento/CatalogInventory/Helper/ProductStockIsQtyDecimal.php
Outdated
Show resolved
Hide resolved
app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php
Outdated
Show resolved
Hide resolved
app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php
Outdated
Show resolved
Hide resolved
This fail relates to the work you have done indirectly. A new dependency added to the class triggered the failure. Usually high object coupling numbers indicates that class has too much responsibilities. The class, where the test failed, indeed has too much different capabilities to it. You may try refactoring it and extracting some parts out of it. |
Hi @vasilii-b , will you continue progress with this issue? |
@vasilii-b. I'm closing this issue due to inactivity. Feel free to reopen it when you decide to proceed. Thank you |
Hi @rogyar @ishakhsuvarov , |
Hi @ishakhsuvarov, could you please review this PR once again ? |
*/ | ||
public function __construct( | ||
$name, | ||
$primaryFieldName, | ||
$requestFieldName, | ||
CollectionFactory $collectionFactory, | ||
Data $dataHelper, | ||
StockStateInterface $stockState, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, inject new dependencies according to our Backward Compatible Development Guide
@@ -69,7 +69,9 @@ public function __construct( | |||
} | |||
|
|||
/** | |||
* {@inheritdoc} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, revert this changes. Just remove curly braces for static test.
@@ -41,7 +41,8 @@ public function __construct( | |||
} | |||
|
|||
/** | |||
* {@inheritdoc} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, revert this changes. Just remove curly braces for static test.
@@ -30,7 +30,8 @@ public function __construct(ArrayManager $arrayManager) | |||
} | |||
|
|||
/** | |||
* {@inheritdoc} | |||
* @param array $meta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, revert this changes. Just remove curly braces for static test.
@@ -67,7 +67,8 @@ public function __construct( | |||
} | |||
|
|||
/** | |||
* {@inheritdoc} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, revert this changes. Just remove curly braces for static test.
@@ -123,7 +130,8 @@ public function __construct( | |||
Data $directoryHelper, | |||
ArrayManager $arrayManager, | |||
$scopeName = '', | |||
GroupSourceInterface $customerGroupSource = null | |||
GroupSourceInterface $customerGroupSource = null, | |||
StockStateInterface $stockState |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, inject new dependencies according to our Backward Compatible Development Guide
* @param AttributeRepositoryInterface|null $attributeRepository | ||
*/ | ||
public function __construct( | ||
LocatorInterface $locator, | ||
ArrayManager $arrayManager, | ||
StockStateInterface $stockState, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, inject new dependencies according to our Backward Compatible Development Guide
* | ||
* @return bool | ||
*/ | ||
public function isStockQtyDecimal($productId, $scopeId = null): bool; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not allowed to add new methods to the existing interfaces according to our Backward Compatible Development Guide. Consider creating a new interface with isStockQtyDecimal
method
140eb17
to
be53c05
Compare
Hi @sidolov, can you please see my latest changes according your requests ? Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for collaboration. Please see the code review notes.
@@ -5,6 +5,9 @@ | |||
*/ | |||
namespace Magento\Bundle\Helper; | |||
|
|||
use Magento\CatalogInventory\Api\StockItemRepositoryInterface; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the unused use references.
* @param array $meta | ||
* @param array $data | ||
* @param \Magento\Ui\DataProvider\AddFieldToCollectionInterface[] $addFieldStrategies | ||
* @param \Magento\Ui\DataProvider\AddFilterToCollectionInterface[] $addFilterStrategies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the duplicate parameter declaration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, that is not a duplicated declaration. They are different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my bad, you are absolutely right!
*/ | ||
public function __construct( | ||
$name, | ||
$primaryFieldName, | ||
$requestFieldName, | ||
CollectionFactory $collectionFactory, | ||
Data $dataHelper, | ||
StockStateInterface $stockState = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the new added dependency to the end of parameters list
/** | ||
* @param LocatorInterface $locator | ||
* @param ArrayManager $arrayManager | ||
* @param StockStateInterface $stockState |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docblock for parameters does not match the actual sequence of parameters
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please enable the strict type mode with declare(strict_types=1);
and specify strict types for parameters
* | ||
* @return bool | ||
*/ | ||
public function isStockQtyDecimal($productId, $scopeId = null): bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please enable strict type mode with declare(strict_types=1);
@sivaschenko can you please take a look on added changes ? Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates. The code is fine, however, there is an issue with commits. It looks like you made commits under two different accounts, CLA is signed only for one of them, can you please squash your changes under the correct github account
* @param array $meta | ||
* @param array $data | ||
* @param \Magento\Ui\DataProvider\AddFieldToCollectionInterface[] $addFieldStrategies | ||
* @param \Magento\Ui\DataProvider\AddFilterToCollectionInterface[] $addFilterStrategies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my bad, you are absolutely right!
Ok @sivaschenko , I'll do it. Thank you! |
… do not work with decimal inventory
d34408b
to
c7e4db8
Compare
Hi @sivaschenko, all checks are passed now. Thank you! |
Hi @sivaschenko, thank you for the review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @vasilii-b thanks for the contribution. Can you please cover the introduced functionality with MFTF/integration tests.
/** | ||
* StockQtyDecimalInterface | ||
*/ | ||
interface StockQtyDecimalInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This interface looks more like SPI than API, it's better to place it in the Model namespace
@vasilii-b closing this pull request due to inactivity. Feel free to reopen it if you'd like to continue progress on it. |
@sivaschenko perfect! I'll delete the branch then as I'm full of played ping-pong here: changes are accepted then after a while comes someone else and request changes (and so a couple of times). Moreover, I've spotted that it is a common approach to "kindly force" for integration tests. I'm doing contribution and as far as I understand it - that's what I like to help with. P.S. moving that service from API to SPI folder could be done on Magento side. |
Description
All issues below are described in #12914
Fixed Issues
[1] Cannot close Advanced Inventory pop-up after setting Qty Uses Decimals to No and having Enable Qty Increments enabled
Steps to reproduce:
Expected Result
Close the Advanced Inventory pop-up
Actual result
Pop-up not closed and no errors are visible
[2] Product Tiered Pricing Issue
Steps to reproduce
[3] Quantity increment issue
Steps to reproduce
Expected result
During each of the above scenarios (2,3), the product should save and allow tiered pricing and qty increments to work with decimal-based inventory
Actual result
Product does not save, admin user is given error stating "Please enter a valid number"
[4] After saving a product with Qty Decimals enabled, Qty Increments and Tier Price Quantity are integer numbers if decimal value was given
Steps to reproduce
Expected result
Tier price Qty is 1.5
Actual result
Tier price Qty is 1
[5] integer vs decimal numbers affects the front-end in the same way, e.g. mini cart and checkout
Steps to reproduce
Use the same steps from [1] or [4]
Expected result
In cart popup, cart page, checkout cart summary product Qty appear with decimals (if applicable)
Actual result
In cart popup, cart page, checkout cart summary product Qty appear without decimals