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

Shipment API won't append comment to email #11207

Closed
JeroenVanLeusden opened this issue Oct 4, 2017 · 9 comments
Closed

Shipment API won't append comment to email #11207

JeroenVanLeusden opened this issue Oct 4, 2017 · 9 comments
Assignees
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development 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

Comments

@JeroenVanLeusden
Copy link
Member

Duplicate of #4320 but since no activity there I created a new one with more detailed information.

Preconditions

  1. Magento v2.1.9
  2. PHP v7.0.14
  3. MySQL v5.6.33

Steps to reproduce

  1. Enable async email sending.
  2. Place an order via the website.
  3. Create a shipment using the API with "appendComment": true.

Expected result

  1. Shipment email is being send with comment appended.

Actual result

  1. Shipment email is being send without comment appended.

API call used

<domain>/rest/all/V1/order/1/ship

{
  "items": [{
    "order_item_id": 1,
    "qty": 1
  }],
  "notify": true,
  "appendComment": true,
  "comment": {
    "comment": "You order will be delivered between 12.00 and 14.00.",
    "is_visible_on_front": 1
  }
}

Workaround

This workaround will use the first comment found with getIsCustomerNotified which is enough for our use case.

Create an after plugin for the \Magento\Sales\Model\Order\ShipmentDocumentFactory::create

public function afterCreate(ShipmentDocumentFactory $subject, ShipmentInterface $shipment)
    {
        foreach ($shipment->getComments() as $comment) {
            /** @var ShipmentCommentInterface $comment */

            if ($comment->getIsCustomerNotified()) {
                $shipment->setCustomerNote($comment->getComment());
                $shipment->setCustomerNoteNotify(true);

                break;
            }
        }

        return $shipment;
    }
@magento-engcom-team magento-engcom-team added Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed labels Oct 4, 2017
@magento-engcom-team
Copy link
Contributor

@JeroenVanLeusden, thank you for your report.
We've created internal ticket(s) MAGETWO-80813 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed 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 Oct 4, 2017
@JeroenVanLeusden
Copy link
Member Author

JeroenVanLeusden commented Oct 10, 2017

I'm working on it #SQUASHTOBERFEST

@okobchenko How you want to see this fixed? Maybe I can give it a go.

I can implement the solution I have right now and only add the first found comment in the email or combine all comments into one message.

@ishakhsuvarov
Copy link
Contributor

Hi @JeroenVanLeusden
It would be best to discuss proposed changes in a PR, as it allows for better code comparison. So feel free to set up a PR with what you have in mind and we can discuss.
Thank you.

@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-81673

@okorshenko
Copy link
Contributor

Hi @JeroenVanLeusden the issue has been fixed in 2.2-develop branch and will be available in 2.2.2 soon

@JeroenVanLeusden
Copy link
Member Author

JeroenVanLeusden commented Oct 17, 2017

@okorshenko Can you please add the #SQUASHTOBERFEST 2017 label to the PR's?

@maksek
Copy link
Contributor

maksek commented Oct 18, 2017

@JeroenVanLeusden we are tracking issues in Done, and linked PR, not needed to assign tag to PR itself.

@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-81716

@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-82187

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 Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development 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

No branches or pull requests

6 participants