magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Magento 2.3.5-p1 - Discount Description, Coupon Codes on Invoices Broken

Open kdjmonaghan opened this issue 5 years ago • 18 comments

Preconditions (*)

  1. Magento 2.4-develop
  2. Magento 2.3.5-p1 Installation
  3. Valid Coupon with a Description

Steps to reproduce (*)

  1. Create valid Coupon with Description Populated (fill the description with say 200 characters for emphasised issue)

Screenshot from 2020-12-04 15-18-14

  1. Create an Order using said Coupon
  2. View Order in CMS at Discount Line (discount line description has changed from hisitoric orders, to be the coupon description)
  3. Generate Invoice (Invoice discouunt line has also changed)
  4. Print PDF (Discount line does not show Coupon Code anymore, but the description)

Expected result (*)

  1. Coupon Code to be shown in Description on Order, Invoice and Invoice PDF

Actual result (*)

  1. Coupon Code is missing from Order, Invoice and Invoice PDF as Discount Description column is now being populated with the description field and not the invoice when Description is populated.

Screenshot from 2020-12-04 15-24-10

Note: If the coupon is without a description then the coupon code is displayed

2020-12-04_15-31


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • [x] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

kdjmonaghan avatar May 29 '20 22:05 kdjmonaghan

Hi @kdjmonaghan. Thank you for your report. To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

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

Please, add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar May 29 '20 22:05 m2-assistant[bot]

For users who seek a fix until Magento either make an option for this in an update, or, make a merge request for this;

Your discount_description field is being populated with the Coupon's description now where as previously in older versions of Magento it was using coupon_code and never actually checked for the presence of the Coupon's description to populate this field.

In recent builds of Magento, Magento have 'fixed' this issue (causing your legacy orders invoices contents data to not match the expected result of new orders, where your legacy orders were 'correct' before) - this results in the coupon code used not being present anywhere to the normal Admin user who does not know how to look up the Coupon Code used within the Order, easily.

The following file is the issue within Vendor:

vendor/magento/module-sales-rule/Model/RulesApplier.php

Look for the addDiscountDescription method and you will see there is a new condition added for setting the Coupon Code Description to the $label variable after the getCouponCode check.

Previously this method, addDiscountDescription looked like this, and you're going to have to replace it via an Extension or Plugin to get it to work as it did before. Comparing the below to what's in this file now will show you the change:

    public function addDiscountDescription($address, $rule)
    {
        $description = $address->getDiscountDescriptionArray();
        $ruleLabel = $rule->getStoreLabel($address->getQuote()->getStore());
        $label = '';
        if ($ruleLabel) {
            $label = $ruleLabel;
        } else {
            if (strlen($address->getCouponCode())) {
                $label = $address->getCouponCode();
            }
        }

        if (strlen($label)) {
            $description[$rule->getId()] = $label;
        }

        $address->setDiscountDescriptionArray($description);

        return $this;
    }

You're going to have to either make a Plugin or extend this module and replace this method within the class to have the original functionality work as the way it did in previous releases of Magento 2.

Your invoices templates, by default, aren't expecting, or formatted, to handle a long description that you can enter into the Discount Description field. This may have been patched as a 'long term bug' (it probably was intended to work like this) but can cause frustration for those expeccting the base functionality to work as it has in previous iterations.

kdjmonaghan avatar May 29 '20 22:05 kdjmonaghan

Hi @krishprakash. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar May 30 '20 04:05 m2-assistant[bot]

@magento give me 2.4-develop instance

krishprakash avatar May 30 '20 05:05 krishprakash

Hi @krishprakash. Thank you for your request. I'm working on Magento 2.4-develop instance for you

magento-engcom-team avatar May 30 '20 05:05 magento-engcom-team

Hi @krishprakash, here is your Magento instance. Admin access: https://i-28432-2-4-develop.instances.magento-community.engineering/admin_043f Login: 4087a0e1 Password: 86b17b7cf138 Instance will be terminated in up to 3 hours.

magento-engcom-team avatar May 30 '20 05:05 magento-engcom-team

Hi @engcom-Alfa. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Dec 04 '20 12:12 m2-assistant[bot]

:white_check_mark: Confirmed by @engcom-Alfa Thank you for verifying the issue. Based on the provided information internal tickets MC-39631 were created

Issue Available: @engcom-Alfa, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

magento-engcom-team avatar Dec 04 '20 13:12 magento-engcom-team

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

stale[bot] avatar Feb 18 '21 14:02 stale[bot]

Issue was confirmed... and never updated upon.

Clearly still an issue.

Description is enough to investigate, clearly, if it was confirmed.

Obviously this is an automated bot, but if an issue has been confirmed then never updated - why should it be closed?

kdjmonaghan avatar Feb 18 '21 14:02 kdjmonaghan

@magento I am working on this

SilinMykola avatar Apr 20 '21 14:04 SilinMykola

Hi @engcom-Bravo. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

    1. Add/Edit Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
    1. If the issue is not relevant or is not reproducible any more, feel free to close it.

m2-assistant[bot] avatar May 22 '24 06:05 m2-assistant[bot]

@magento give me 2.4-develop instance

engcom-Bravo avatar May 22 '24 06:05 engcom-Bravo

Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.

Hi @engcom-Bravo, here is your Magento Instance: https://7353e34217821129194bf61186089f6e.instances-prod.magento-community.engineering Admin access: https://7353e34217821129194bf61186089f6e.instances-prod.magento-community.engineering/admin_d78a Login: bad13834 Password: 8f08dc148309

HI @kdjmonaghan,

Thanks for your reporting and collaboration.

We have verified the issue in Latest 2.4-develop instance and the issue is reproducible.Kindly refer the screenshots.

Screenshot 2024-05-22 at 12 19 00

Coupon Code is missing from Order, Invoice and Invoice PDF as Discount Description column is now being populated with the description field and not the invoice when Description is populated.

Hence Confirming the issue.

Thanks.

engcom-Bravo avatar May 22 '24 06:05 engcom-Bravo

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-11991 is successfully created for this GitHub issue.

github-jira-sync-bot avatar May 22 '24 07:05 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-Bravo. Thank you for verifying the issue.
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar May 22 '24 07:05 m2-assistant[bot]