Jump to content

PDF invoice problem after upgrade


Recommended Posts

Hi everbody,

I have update my shop to prestashop 1.3.2

By the new order the PDF invoice can I open without problems.
But by the orders from the past, it says only:

Fatal error

All my previous orders in the store have the same problem, I cann't open the invoice.

The customer can also n't open it. (the same error)

Can somebody help me with this issue?

Link to comment
Share on other sites

Temporarily change line 403 of classes/Tools.php from:

//    if ($string == 'Fatal error') d(debug_backtrace());



to:

if ($string == 'Fatal error') d(debug_backtrace());



This will display a stack trace instead of just "Fatal error". This should help you pinpoint the cause of the error.

Link to comment
Share on other sites

Ok,

When I now try to open the PDF invoice in the admin I get this page:

URL : pdf.php?id_order=436&pdf;

Array

[code]
   [0] => Array
       (
           [file] => /home/pvc-tarp.com/www/classes/Cart.php
           [line] => 131
           [function] => displayError
           [class] => Tools
           [type] => ::
           [args] => Array
               (
               )

       )

   [1] => Array
       (
           [file] => /home/pvc-tarp.com/www/classes/Order.php
           [line] => 402
           [function] => getTaxesAverageUsed
           [class] => Cart
           [type] => ::
           [args] => Array
               (
                   [0] => 3455
               )

       )

   [2] => Array
       (
           [file] => /home/pvc-tarp.com/www/classes/PDF.php
           [line] => 469
           [function] => getTaxesAverageUsed
           [class] => Order
           [type] => ->
           [object] => Order Object
               (
                   [id_address_delivery] => 590
                   [id_address_invoice] => 590
                   [id_cart] => 3455
                   [id_currency] => 1
                   [id_lang] => 3
                   [id_customer] => 522
                   [id_carrier] => 137
                   [secure_key] => 6360ef001c7a2a3f1febde1743dc5faa
                   [payment] => PayPal
                   [module] => paypal
                   [recyclable] => 1
                   [gift] => 0
                   [gift_message] => 
                   [shipping_number] => 
                   [total_discounts] => 0.00
                   [total_paid] => 43.40
                   [total_paid_real] => 43.40
                   [total_products] => 32.29
                   [total_products_wt] => 37.41
                   [total_shipping] => 6.00
                   [total_wrapping] => 0.00
                   [invoice_number] => 432
                   [delivery_number] => 374
                   [invoice_date] => 2010-10-21 23:00:16
                   [delivery_date] => 2010-10-22 10:01:03
                   [valid] => 1
                   [date_add] => 2010-10-21 23:00:15
                   [date_upd] => 2010-10-25 19:33:30
                   [tables:protected] => Array
                       (
                           [0] => orders
                       )

                   [fieldsRequired:protected] => Array
                       (
                           [0] => id_address_delivery
                           [1] => id_address_invoice
                           [2] => id_cart
                           [3] => id_currency
                           [4] => id_lang
                           [5] => id_customer
                           [6] => id_carrier
                           [7] => payment
                           [8] => total_paid
                           [9] => total_paid_real
                           [10] => total_products
                           [11] => total_products_wt
                       )

                   [fieldsSize:protected] => Array
                       (
                           [payment] => 32
                       )

                   [fieldsValidate:protected] => Array
                       (
                           [id_address_delivery] => isUnsignedId
                           [id_address_invoice] => isUnsignedId
                           [id_cart] => isUnsignedId
                           [id_currency] => isUnsignedId
                           [id_lang] => isUnsignedId
                           [id_customer] => isUnsignedId
                           [id_carrier] => isUnsignedId
                           [secure_key] => isMd5
                           [payment] => isGenericName
                           [recyclable] => isBool
                           [gift] => isBool
                           [gift_message] => isMessage
                           [total_discounts] => isPrice
                           [total_paid] => isPrice
                           [total_paid_real] => isPrice
                           [total_products] => isPrice
                           [total_products_wt] => isPrice
                           [total_shipping] => isPrice
                           [total_wrapping] => isPrice
                           [shipping_number] => isUrl
                       )

                   [table:protected] => orders
                   [identifier:protected] => id_order
                   [_taxCalculationMethod:private] => 0
                   [id] => 436
                   [fieldsRequiredLang:protected] => Array
                       (
                       )

                   [fieldsSizeLang:protected] => Array
                       (
                       )

                   [fieldsValidateLang:protected] => Array
                       (
                       )

               )

           [args] => Array
               (
               )

       )


Link to comment
Share on other sites

I can't help without more information. Try adding the following before line 271 of tools/fpdf/fpdf.php from:

die('FPDF error: '.$msg);



to:

var_dump(debug_backtrace());
die('FPDF error: '.$msg);



This should provide more information about the error.

Link to comment
Share on other sites

ok, I see this code, and then 4 pages...

array(3) { [0]=> array(7) { ["file"]=> string(42) "/home/pvc-tarp.com/www/tools/fpdf/fpdf.php" ["line"]=> int(1032) ["function"]=> string(5) "Error" ["class"]=> string(4) "FPDF" ["type"]=> string(2) "->" ["object"]=> object(PDF)#13 (61) { ["NewPageGroup"]=> bool(false) ["PageGroups"]=> array(1) { ["{nb1}"]=> int(1) } ["CurrPageGroup"]=> string(5) "{nb1}" ["page"]=> int(1) ["n"]=> int(9) ["offsets"]=> array(9) { [3]=> int(9) [4]=> int(376) [1]=> int(1739) [5]=> int(1826) [6]=> int(1927) [7]=> int(2023) [2]=> int(43055) [8]=> int(43179) [9]=> int(43254) } ["buffer"]=> string(43636) "%PDF-1.3 3 0 obj <<<>>><<>>>] /Contents 4 0 R>> endobj 4 0 obj <> stream x��WKS�8>O��}���=-�[�c��l�=��!$"�$�80ˉ��-?bہj���O��u����%J�s�'���(���(��@�!LWpx��d �c8�L��69����J)���0?<������ \e����}��d��Mm�`��nX0�5ta�Ih������b0��9�8i��a�14�;]nV�d�l�x�ďXf���@d�Zi5:�����/�ɲ��85�Af{ig6YN�Yq�%�dP�?��r�A@�%Q�L�_-�'��`�I��ݾTJ��lF�8e������ �!aV�J��r � M�<<&��v���钠��P̓�:�+�Jw��F��\�7�Q�a� �m4�D�p��S���b�q���T��a�c �՝���ɯ<�?���á,=�W`Aw4%�bEQI���#���n��D>�< ��[� /��-��$�w]�nQ�R�bW �r]����2��h���hz���X �3Gb]�r8B� �B1���$�q���U�|o}ID�oξJ�)pl��7����P�ٰ�R�٤�g�{�(nx����M�7 �%����8�u::9w�,<��M�����&t;�,�%�M��ܯO�u�%��������oHE��2��v/�jn�jq�X����f���@����̸y�]{��-7G���>m�C:8��2���F��T C�z�>�-�/|G����n��pp�vq׃�P�z��'�����Q���w�rW���|� endstream endobj 1 0 obj <> endobj 5 0 obj <> endobj 6 0 obj <> endobj 7 0 obj <> stream �����JFIF���������;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 90 ���C�     ���C    ���a"�������������� �������}�!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz����������������������������������������������������������������������������������� ������w�!1AQaq"2�B���� #3R�br� $4�%�&'()*567

Link to comment
Share on other sites

It's line 1032 of tools/fpdf/fpdf.php that is causing the error:

if(ob_get_length())
   $this->Error('Some data has already been output, can\'t send PDF file');



It seems ob_get_length() is returning a length greater than 0 when it shouldn't. Unfortunately, I have no idea how to fix it.

Link to comment
Share on other sites

I have just upgraded to 1.3.2.3 I get the following message:

Fatal error: Call to undefined method Cart::getTaxesAverageUsed() in /dirpathway/shop/classes/Order.php on line 408

when viewing customer order pdfs in the front end.

I have tried Straigh&Alert;'s solution of removing the extract white spaces after the ?> in classed/Product.php but I still get this message. A quick solution to this problem is most appreciated.

Thanks, Marco

Link to comment
Share on other sites

  • 1 month later...

I just updated from 1.3.2 to 1.3.3 and get the error when trying to generate a PDF invoice for an old order. Other orders generate a PDF just fine. The problem is both on the backend and when the user is logged in the front end.

Here's related debug info. I kept the old 1.3.2 directory and renamed it. By renaming the old and new installs so the old 1.3.2 version is active, I am able to generate a PDF invoice.

Enabling debug in the Tools.php results in the following for the 1.3.3 version.

Array
(
   [0] => Array
       (
           [file] => /home/j30/www/www/shop/classes/Cart.php
           [line] => 130
           [function] => displayError
           [class] => Tools
           [type] => ::
           [args] => Array
               (
               )

       )

   [1] => Array
       (
           [file] => /home/j30/www/www/shop/classes/Order.php
           [line] => 415
           [function] => getTaxesAverageUsed
           [class] => Cart
           [type] => ::
           [args] => Array
               (
                   [0] => 14
               )

       )

   [2] => Array
       (
           [file] => /home/j30/www/www/shop/classes/PDF.php
           [line] => 467
           [function] => getTaxesAverageUsed
           [class] => Order
           [type] => ->
           [object] => Order Object
               (
                   [id_address_delivery] => 8
                   [id_address_invoice] => 8
                   [id_cart] => 14
                   [id_currency] => 2
                   [id_lang] => 1
                   [id_customer] => 2
                   [id_carrier] => 17
                   [secure_key] => ****************************** deleted
                   [payment] => PayPal
                   [module] => paypal
                   [recyclable] => 0
                   [gift] => 0
                   [gift_message] => 
                   [shipping_number] => 
                   [total_discounts] => 0.00
                   [total_paid] => 70.00
                   [total_paid_real] => 70.00
                   [total_products] => 60.00
                   [total_products_wt] => 60.00
                   [total_shipping] => 10.00
                   [total_wrapping] => 0.00
                   [invoice_number] => 6
                   [delivery_number] => 4
                   [invoice_date] => 2010-11-23 11:40:40
                   [delivery_date] => 2010-12-09 22:07:51
                   [valid] => 1
                   [date_add] => 2010-11-23 11:40:38
                   [date_upd] => 2010-12-11 23:02:46
                   [tables:protected] => Array
                       (
                           [0] => orders
                       )

                   [fieldsRequired:protected] => Array
                       (
                           [0] => id_address_delivery
                           [1] => id_address_invoice
                           [2] => id_cart
                           [3] => id_currency
                           [4] => id_lang
                           [5] => id_customer
                           [6] => id_carrier
                           [7] => payment
                           [8] => total_paid
                           [9] => total_paid_real
                           [10] => total_products
                           [11] => total_products_wt
                       )

                   [fieldsSize:protected] => Array
                       (
                           [payment] => 32
                       )

                   [fieldsValidate:protected] => Array
                       (
                           [id_address_delivery] => isUnsignedId
                           [id_address_invoice] => isUnsignedId
                           [id_cart] => isUnsignedId
                           [id_currency] => isUnsignedId
                           [id_lang] => isUnsignedId
                           [id_customer] => isUnsignedId
                           [id_carrier] => isUnsignedId
                           [secure_key] => isMd5
                           [payment] => isGenericName
                           [recyclable] => isBool
                           [gift] => isBool
                           [gift_message] => isMessage
                           [total_discounts] => isPrice
                           [total_paid] => isPrice
                           [total_paid_real] => isPrice
                           [total_products] => isPrice
                           [total_products_wt] => isPrice
                           [total_shipping] => isPrice
                           [total_wrapping] => isPrice
                           [shipping_number] => isUrl
                       )

                   [table:protected] => orders
                   [identifier:protected] => id_order
                   [_taxCalculationMethod:private] => 0
                   [id] => 6
                   [fieldsRequiredLang:protected] => Array
                       (
                       )

                   [fieldsSizeLang:protected] => Array
                       (
                       )

                   [fieldsValidateLang:protected] => Array
                       (
                       )

               )

           [args] => Array
               (
               )

       )

   [3] => Array
       (
           [file] => /home/j30/www/www/shop/pdf-invoice.php
           [line] => 20
           [function] => invoice
           [class] => PDF
           [type] => ::
           [args] => Array
               (
                   [0] => Order Object
                       (
                           [id_address_delivery] => 8
                           [id_address_invoice] => 8
                           [id_cart] => 14
                           [id_currency] => 2

Link to comment
Share on other sites

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
×
×
  • Create New...