Jump to content

Can’t view Invoices - Fatal Error


berta recchia

Recommended Posts

I'm having a serious issue with Invoices. Neither I nor the customers can view ANY invoice.

When I click on one I get "Fatal Error" and a blank page.

With error checing enabled I get this:

"Notice: Undefined variable: invoice_address in /home/anticoelements/public_html/classes/PDF.php on line 402 Notice: Trying to get property of non-object in /home/anticoelements/public_html/classes/PDF.php on line 402 Notice: Undefined variable: invoice_address in /home/anticoelements/public_html/classes/PDF.php on line 423 Notice: Trying to get property of non-object in /home/anticoelements/public_html/classes/PDF.php on line 423 Notice: Undefined variable: invoice_address in /home/anticoelements/public_html/classes/PDF.php on line 423"

We modified PDF.php a long time ago and it all worked until today. We put the original PDF.php back and the problem is still coming up.

We can't figure out what it could be!

Any suggestion?

Link to comment
Share on other sites

Hello,

I am currently testing the migration of my shop in Version 1.3.1.1 Version 1.4.0.17.
The PDF invoice generation works fine when I do a clean install (no update).
But when I make update I can no longer edit the invoices listed BO as the client side FO, while vouchers work quite well.

I get this message:
"Fatal Error" in a beautiful blank page

I enabled Verbose errors and in fact it blocks the function:

Class / Cart.php: getTaxesAverageUsed

$cart = new Cart((int)($id_cart));

       if (!Validate::isLoadedObject($cart))
           die(Tools::displayError()); 


I think it can not create a cart for the calculation of the bill, but why?


If I replace the modules and the classes directory works (clean install) on the one that does not work (installed with update) I have the same error message?

There would not be a problem on the update of the database?

PS : Sorry for my english :red:

Link to comment
Share on other sites

Yes, that's where the problem is. It's the information in the cart. If somehow we lose the cart info, the invoices are the cannot be viewed.

I had to delete some carts manually because my UPS module pukes when some1 puts a lot of products in his carts and it slows down the whole site until thoese carts are deleted. Those invices are sadly gone. Very strange way to gather info for an invoce of an order already submitted.

Thanks.

Link to comment
Share on other sites

I think to have found sometyhing :gulp:

If i delete the cart, in the table ps_cart, corresponding of my order I have the same error "Fatal error" :snake:

if i change the id_cart corresponding at an older order I can show the invoice ;-P


So before this version if you delete the cart existing in the ps_cart you do not have any error to print the invoice.

I think it can not be recreate the cart to calculate the content.

If you can help me to solve this issue about

classes/Cart.php

    static public function getTaxesAverageUsed($id_cart)
   {
       $cart = new Cart((int)($id_cart));
       if (!Validate::isLoadedObject($cart))
           die(Tools::displayError());

       if (!Configuration::get('PS_TAX'))
           return 0;

       $products = $cart->getProducts();
       $totalProducts_moy = 0;
       $ratioTax = 0;

       if (!sizeof($products))
           return 0;

       foreach ($products AS $product)
       {
           $totalProducts_moy += $product['total_wt'];
           $ratioTax += $product['total_wt'] * Tax::getProductTaxRate((int)$product['id_product'], (int)$cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
       }

       if ($totalProducts_moy > 0)
           return $ratioTax / $totalProducts_moy;

       return 0;
   }



because if i comment this to line it's work well (but i don't if it's correct)

        //if (!Validate::isLoadedObject($cart))
       //    die(Tools::displayError());

Link to comment
Share on other sites

I think to have found sometyhing :gulp:

if i change the id_cart corresponding at an older order I can show the invoice ;-P

[/code]


Where do you change the cart id? Which table? I tried to change the id_cart in table ps_orders for one order. I tried different numbers but I still can't view the invoice for that order.

Am I missing something?

Thanks.
Link to comment
Share on other sites

In the ps_order table you have a column named id_cart. So you take the number correcponding of your order and change the number, in the ps_cart table, of a existing cart with the value taking just before, in the column id_cart.

And now you can edit the invoice corresponding of your order.

Link to comment
Share on other sites

  • 8 months later...

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...