Jump to content

Errors after upgrade to 1.6.1.1 - undefined method OrderInvoice


Recommended Posts

Hello Forum,

I really hope some of you can help me.

 

I just updated my shop from 1.6.0.14 to 1.6.1.1 through the 1-click installer. All went fine.

But now I see some errors in the backoffice. When I am on a order an click documents and delivery slip or invoice, I get these errors:

 

Fatal error: Call to undefined method OrderInvoice::getCurrentFormattedShopAddress() in /home/profilla/public_html/classes/pdf/HTMLTemplateDeliverySlip.php on line 49

 

Fatal error: Call to undefined method OrderInvoice::getCurrentFormattedShopAddress() in /home/profilla/public_html/classes/pdf/HTMLTemplateInvoice.php on line 51

 

This all worked fine before the upgrade... Anyone with an idea how to fix it ?

 

Thanks.

Link to comment
Share on other sites

Hello tuk66,

It looks like it is, and in the bottom of that file I also find this function:

 

/**
     * This method is used to fix shop addresses that cannot be fixed during upgrade process
     * (because uses the whole environnement of PS classes that is not available during upgrade).
     * This method should execute once on an upgraded PrestaShop to fix all OrderInvoices in one shot.
     * This method is triggered once during a (non bulk) creation of a PDF from an OrderInvoice that is not fixed yet.
     *
     * @since 1.6.1.1
     */
    public static function fixAllShopAddresses() {
        $shop_ids = Shop::getShops(false, null, true);
        $db = Db::getInstance();
        foreach($shop_ids as $id_shop) {
            $address = self::getCurrentFormattedShopAddress($id_shop);
            $escaped_address = $db->escape($address, true, true);
 
            $db->execute('UPDATE `'._DB_PREFIX_.'order_invoice` INNER JOIN `'._DB_PREFIX_.'orders` USING (`id_order`)
                SET `shop_address` = \''.$escaped_address.'\' WHERE `shop_address` IS NULL AND `id_shop` = '.$id_shop);
        }
    }
}
 
I dont think this function has been run yet... how do I force it to run ?
Because in the file which makes the error, I find this code:
 
        // If shop_address is null, then update it with current one.
        // But no DB save required here to avoid massive updates for bulk PDF generation case.
        // (DB: bug fixed in 1.6.1.1 with upgrade SQL script to avoid null shop_address in old orderInvoices)
        if (!isset($this->order_invoice->shop_address) || !$this->order_invoice->shop_address) {
            $this->order_invoice->shop_address = OrderInvoice::getCurrentFormattedShopAddress((int)$this->order->id_shop);
            if (!$bulk_mode) {
                OrderInvoice::fixAllShopAddresses();
            }
        }
Link to comment
Share on other sites

I've seen something similar. Strange. It should be:

 

'OrderInvoice' => 
  array (
    'path' => 'override/classes/order/OrderInvoice.php',
    'type' => 'class',
    'override' => false,
  ),
  'OrderInvoiceCore' => 
  array (
    'path' => 'classes/order/OrderInvoice.php',
    'type' => 'class',
    'override' => false,
  ),
 
Fix it or remove the file and it will be recreated (let's hope).
Link to comment
Share on other sites

I tried to remove the file... It got recreated again, but with the same errors.
Then I tried to change it according to your instructions, and when I try to click on an order, i get a "servererror 500" ??

 

I am willing to pay you, if you can fix it for me, and if you like, we can take it through Skype chat, and post the solution here ?

Thanks.

Link to comment
Share on other sites

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