Skip to content

10210: Transport variable can not be altered in email_invoice_set_template_vars_before Event (backport MAGETWO-69482 to 2.1). #12135

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

Merged
merged 1 commit into from
Nov 27, 2017

Conversation

RomaKis
Copy link
Contributor

@RomaKis RomaKis commented Nov 9, 2017

Backport MAGETWO-69482.

Fixed Issues (if relevant)

  1. Transport variable can not be altered in email_invoice_set_template_vars_before Event #10210: Transport variable can not be altered in email_invoice_set_template_vars_before Event (backport MAGETWO-69482 to 2.1).

Manual testing scenarios

  1. Declare the event
<event name="email_invoice_set_template_vars_before">
        <observer name="mod_mail_variables_of_Invoice" instance="Vendor\Module\Observer\ChangePaymentHtml" />
    </event>
  1. Alter variable payment_html in Vendor\Module\Observer\ChangePaymentHtml like
<?php

namespace Venoor\Module\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Event\Observer;
use Magento\Framework\App\Request\DataPersistorInterface;
use Magento\Framework\App\ObjectManager;
use Vendor\Module\Helper\Data as PaymentHelper;
use Magento\Sales\Model\Order;

class ChangePaymentHtml implements ObserverInterface
{
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
         $transport = $observer->getEvent()->getData('transportObject');

        $transport['payment_html'] = '<div>SOME PAYMENT INFO</div>';
        $observer->setData('transportObject', $transport);
    }
}
  1. Create order -> create Invoice.
  2. Open invoice.
  3. Press Send email.
  4. Open email. Payment method should be "SOME PAYMENT INFO" .

Expected result

  1. Email should be modified and new or changed variables should be output in email.

Actual result

  1. Email is unchanged, and $transport variable seems not to be changed.

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)

…plate_vars_before Event (backport MAGETWO-69482 to 2.1)
@magento-engcom-team magento-engcom-team added bugfix Fixed in 2.3.x The issue has been fixed in 2.3 release line Component: Payment 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 labels Nov 9, 2017
@fooman fooman self-assigned this Nov 18, 2017
@fooman fooman added this to the November 2017 milestone Nov 18, 2017
@okorshenko okorshenko merged commit ffe97c1 into magento:2.1-develop Nov 27, 2017
okorshenko pushed a commit that referenced this pull request Nov 27, 2017
…invoice_set_template_vars_before Event (backport MAGETWO-69482 to 2.1). #12135
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Component: Payment Fixed in 2.3.x The issue has been fixed in 2.3 release line Progress: accept Release Line: 2.1 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants