Skip to content

Fix issue with "Apply Discount Code" input hidden, when code is applied #24467

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

iGerchak
Copy link
Contributor

@iGerchak iGerchak commented Sep 5, 2019

Preconditions

Magento 2.3.2

Description

"Apply Discount Code" input should be shown when customer applied coupon code

Steps to reproduce:

  1. Add product to the cart
  2. Go to the cart page and ally coupon code
  3. Reload the page

Expected result

"Apply Discount Code" input is opened:
Capture 2019-09-05 at 17 55 05

Actual result

"Apply Discount Code" input is hidden:
Capture 2019-09-05 at 17 54 40

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Sep 5, 2019

Hi @iGerchak. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

@@ -7,7 +7,7 @@
?>
<div class="block discount"
id="block-discount"
data-mage-init='{"collapsible":{"openedState": "active", "saveState": false}}'
data-mage-init='{"collapsible":{"active": <?= strlen($block->getCouponCode()) ? 'true' : 'false' ?>, "openedState": "active", "saveState": false}}'
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @iGerchak. I think we can simply convert strlen($block->getCouponCode()) to the bool, instead of use comparation operator.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it was done just in the same way as on line 23 https://github.com/magento/magento2/pull/24467/files#diff-064408e40cf6c624ca3a7a8adfda18a8R23

In this case we should fix that part line also

Copy link
Contributor

@VladimirZaets VladimirZaets left a comment

Choose a reason for hiding this comment

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

Hi @iGerchak. Please take a look at my review comment.

@ghost ghost assigned VladimirZaets Sep 5, 2019
@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-5791 has been created to process this Pull Request
✳️ @sidolov, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

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

Hi @iGerchak,
I see that in this file there are a lot of places where checked strlen($block->getCouponCode()).

Could you replace it to $block->getCouponCode() in all places?
Thank you!

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

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

Ah, I just realised that $block->getCouponCode() will not work for instance if we'll have coupon code 0. Could you move strlen($block->getCouponCode()) to variable and use it in all places in this file?

Once you'll finish it - please squash all your changes to single commit and force push it.

Thank you!

@iGerchak iGerchak force-pushed the fix-issue-with-discount-input branch 2 times, most recently from 2169bd6 to b11f353 Compare September 6, 2019 07:16
@iGerchak iGerchak force-pushed the fix-issue-with-discount-input branch from b11f353 to 9da6a58 Compare September 6, 2019 07:25
@ihor-sviziev ihor-sviziev added the Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests label Sep 6, 2019
@ihor-sviziev
Copy link
Contributor

Would be great to cover this case with functional tests, I added tag Auto-Tests: Not Covered

@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-5791 has been created to process this Pull Request
✳️ @ihor-sviziev, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@magento-engcom-team
Copy link
Contributor

Hi @VladimirZaets, thank you for the review.
ENGCOM-5791 has been created to process this Pull Request

@engcom-Delta
Copy link
Contributor

✔️ QA passed

@m2-assistant
Copy link

m2-assistant bot commented Sep 10, 2019

Hi @iGerchak, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

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.

6 participants