0

I want to overwrite pdf.xml in Magento 2.1.3 to change order for the total block, but i can't figure out how i can do that.

The totals are ordered in pdf.xml in Magento/sales/pdf

Edit:
First I had only extend the invoice file: <preference for="Magento\Sales\Model\Order\Pdf\Invoice" type="Hc\Sales\Model\Pdf\Invoice" />

And I have tried to extend the reader class <preference for="Magento\Sales\Model\Order\Pdf\Config\Reader" type="Hc\Sales\Model\Pdf\Reader" />

But I get always the same error:

1 exception(s): Exception #0 (Exception): Warning: Magento\Framework\Config\Dom::_mergeNode(): unterminated entity reference`

2

M2 cannot merge this line

<title translate="true">Shipping &amp; Handling</title>

because of xml merge issue with ampersand encoding,

possible solutions:

  • remove this one line from your custom pdf
  • in your custom pdf write for example 'Shipping and Handling'
1

The solution is to copy the pdf.xml file into your custom module etc file.

Modify the sort_order of the field you want to change in your custom copy and get rid of the extra stuff you don't need.

Also don't forget to make your module depend on the Sales module.

1
  • 1
    Sorry but allready tried that, but maybe I do something wrong. I extend the invoice by using <preference for="Magento\Sales\Model\Order\Pdf\Invoice" type="Hc\Sales\Model\Pdf\Invoice" /> And I have tried to extend the reader class ..Pdf\Config\Reader but I get always the same error: 1 exception(s): Exception #0 (Exception): Warning: Magento\Framework\Config\Dom::_mergeNode(): unterminated entity reference – Martijn Apr 10 '17 at 10:51
1

In addition to Oleksandr Makhno's answer:

you could try

<title translate="true"><![CDATA[Shipping & Handling]]></title>

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.