I want to extend the \Magento\Sales\Block\Order\Email\Items\DefaultItems.php
class so I can add an extra function instead of putting in the core file. (which works btw)
I tried it with creating a preference in my di.xml in my custom module like this;
<preference for="\Magento\Sales\Block\Order\Email\Items\DefaultItems"
type="MyModule\MyVendor\Rewrite\Magento\Sales\Order\Email\Items\DefaultItems" />
Then extend the class like the this:
<?php
namespace MyModule\MyVendor\Rewrite\Magento\Sales\Order\Email\Items;
class DefaultItems extends \Magento\Sales\Block\Order\Email\Items\DefaultItems
{
/**
* DefaultItems constructor.
*/
public function __construct()
{
die('Class extended');
}
}
When I make a functiongetSku()
my IDE (PHPstorm) shows that it will be overridden like it supposed to. When sending an invoice email through the backend it will show me the die in the constructor.
When deleting the constructor (or the die) I am getting the following error message:
Unknown template engine type ".
So what am i missing here, any ideas?