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

Fix missing discount label in checkout #13141

Merged
merged 3 commits into from Jan 17, 2018

Conversation

ihor-sviziev
Copy link
Contributor

@ihor-sviziev ihor-sviziev commented Jan 11, 2018

Description

The discount label was not being shown in the shopping cart totals description
Continuing of #11883

Fixed Issues

  1. Discount Rule does not show Default Rule Label #11497: Discount Rule does not show Default Rule Label
  2. Cart Price Rule Label is not working #11428: Cart Price Rule Label is not working

Manual testing scenarios

  1. Add a discount to quote
  2. Go to the shopping cart and now see the discount label in the totals description

Related PRs

#13141
#13223

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 on Travis CI are green)

@magento-engcom-team magento-engcom-team added Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Jan 11, 2018
@rogyar rogyar self-assigned this Jan 11, 2018
return null;
}

var discountSegments = this.totals()['total_segments'].filter(function (segment) {
Copy link
Contributor

Choose a reason for hiding this comment

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

All variables declarations must be at the top of the function scope. Please, try to move the variable declaration to the beginning of the getTitle() function

}

var discountSegments = this.totals()['total_segments'].filter(function (segment) {
return (segment.code === 'discount');
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess, the parenthesis is redundant here. This fact is the reason of failing static tests

@okorshenko
Copy link
Contributor

@rogyar Thank you for the review! 👍

@pemann
Copy link

pemann commented Apr 13, 2018

Is this part of the upcoming 2.2.4 release?

@ihor-sviziev ihor-sviziev deleted the fix-discount-label branch April 13, 2018 08:53
@rsantellan
Copy link
Contributor

rsantellan commented Jun 12, 2018

This fix is part of the release 2.2.4 and now my custom discount is shown but the label discount is not. Is there a way to fix that ? Because it only check the word discount not any thing containing discount.

A possible change could be:

        /**
         * Get discount title
         *
         * @returns {null|String}
         */
        getTitle: function () {
            var discountSegments;

            if (!this.totals()) {
                return null;
            }

            discountSegments = this.totals()['total_segments'].filter(function (segment) {
                return segment.code.indexOf('discount') !== -1;
            });

            return discountSegments.length ? discountSegments[0].title : null;
        },

@ihor-sviziev
Copy link
Contributor Author

@rsantellan feel free to create PR with your changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Progress: accept Release Line: 2.2 Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants