0

I need to overwrite Ahimsa\Sales\Model\Order\Email\Sender\OrderSender just to add new methods to return payment informations, but when I put the OrderSender.php file in my custom module do not work.

I Need to overwrite this class to make some changes in new order email template. I do not want to return the payment information like a html block, I need the separate payment information.

Any help?

Tks!

0

You should create a plugin for it in your custom module. There is a Magento docs page on it here.

It will be something similair to this:

VENDOR/MODULENAME/etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <type name="Magento\Checkout\Model\GuestPaymentInformationManagement">
        <plugin name="guest-checkout-payment" type="VENDOR\YOURMODULE\Model\Checkout\GuestPaymentInformationManagementPlugin" sortOrder="10"/>
    </type>
</config>

Replace the path with the path for the php file that you want to write the plugin for. And then create your php file like the doc states.

  • In the reading I did in the documentation you can only intercept public methods with the plugin and I need to override a protected method – Diego Queiroz Jul 23 '18 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.