-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Component: PaymentFixed in 2.1.xThe issue has been fixed in 2.1 release lineThe issue has been fixed in 2.1 release lineFixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releasebug report
Description
We waht to change the payment_html for banktransfer invoices. Unfortunately the instruction is also sent in invioce email. And there the customer already has paid the bill.
Preconditions
- Magento 2.1.7
- PHP 7.0.2
- MySql 5.7
Steps to reproduce
- Declare the event
<event name="email_invoice_set_template_vars_before">
<observer name="mod_mail_variables_of_Invoice" instance="Vendor\Module\Observer\ChangePaymentHtml" />
</event>
- 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
{
protected $paymentHelper;
public $logger;
public function __construct(
PaymentHelper $paymentHelper,
\Psr\Log\LoggerInterface $logger
) {
$this->paymentHelper = $paymentHelper;
$this->logger = $logger;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
$transport = $observer->getEvent()->getTransport();
$paymentInfo = $this->getPayment($transport['order'], $transport['store']->getStoreId());
if ($paymentInfo->getTemplate() == 'info/instructions.phtml') {
$paymentInfo->setTemplate('Vendor_Module::payment/info/invoicepaymentinfo.phtml');
}
$transport['payment_html'] = $paymentInfo->toHtml();
$observer->setData('transport', $transport);
}
protected function getPayment(Order $order, $storeid)
{
return $this->paymentHelper->getRawInfoBlock(
$order->getPayment(),
$storeid
);
}
}
Expected result
- Email should be modified and new or changed variables should be output in email.
Actual result
- Email is unchanged, and $transport variable seems not to be changed.
Metadata
Metadata
Assignees
Labels
Component: PaymentFixed in 2.1.xThe issue has been fixed in 2.1 release lineThe issue has been fixed in 2.1 release lineFixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releasebug report