Jump to content

[SOLVED] Invoice pdf not displaying actual vat rate.


Nickovitshj
 Share

Recommended Posts

PrestaShop Version: 1.7.6.5

Hey all, my vat rate should be 21%. However it is displaying the following in the field: %VATr ate% %
I've went throught the invoice.tpl files but I couldn't find this variable anywhere.

Can anyone help me with this?

Thanks in advance,
Nick

Screenshot 2021-04-27 at 11.58.56.png

Edited by Nickovitshj (see edit history)

Share this post


Link to post
Share on other sites

Solution:

My solution isn't best practice but it actually works. Maybe someone with more knowledge can elaborate on this.

In following file: classes/pdf/HTMLTemplateInvoice.php
Go to line 180:

// Set tax_code
            $taxes = OrderDetail::getTaxListStatic($id);
            $tax_temp = array();
            foreach ($taxes as $tax) {
                $obj = new Tax($tax['id_tax']);
                $translator = Context::getContext()->getTranslator();
                $tax_temp[] = $translator->trans(
                    '%taxrate%%space%%',
                    array(
                        '%taxrate%' => ($obj->rate + 0),
                        '%space%' => ' ',
                    ),
                    'Shop.Pdf'
                );
            }

And replace this with:

// Set tax_code
            $taxes = OrderDetail::getTaxListStatic($id);
            $tax_temp = array();
            foreach ($taxes as $tax) {
                $obj = new Tax($tax['id_tax']);
                $translator = Context::getContext()->getTranslator();
                $tax_temp[] = $translator->trans(
                    '%taxrate%%nothing%%',
                    array(
                        '%taxrate%' => ($obj->rate + 0),
                        '%nothing%' => '',
                    ),
                    'Shop.Pdf'
                );
            }

The issue was that it translated the following variable: '%taxrate%%space%%' into '%Vatrate%%space%%'
But the translated variable doesn't exist, thus in the invoice pdf it didn't show the value it's supposed to.

 

With my "ugly" fix it now shows the actual vat rate %

Screenshot 2021-04-27 at 13.24.52.png

Share this post


Link to post
Share on other sites

  • Nickovitshj changed the title to [SOLVED] Invoice pdf not displaying actual vat rate.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More