skinnybloke Posted September 10 Share Posted September 10 (edited) I have a problem with a payment module on the order confirmation page with Prestashop v9.0. The following error is displayed: Fatal error: Uncaught Error: Call to undefined method Tools::displayPrice() in /home/testsites/testnewversion/modules/opayo/opayo.php:519 Stack trace: #0 /home/testsites/testnewversion/classes/Hook.php(1251): Opayo->hookPaymentReturn(Array) #1 /home/testsites/testnewversion/classes/Hook.php(462): HookCore::coreCallHook(Object(Opayo), 'hookPaymentRetu...', Array) #2 /home/testsites/testnewversion/classes/Hook.php(1143): HookCore::callHookOn(Object(Opayo), 'paymentReturn', Array) #3 /home/testsites/testnewversion/controllers/front/OrderConfirmationController.php(255): HookCore::exec('displayPaymentR...', Array, 130) #4 /home/testsites/testnewversion/controllers/front/OrderConfirmationController.php(232): OrderConfirmationControllerCore->displayPaymentReturn(Object(Order)) #5 /home/testsites/testnewversion/classes/controller/Controller.php(330): OrderConfirmationControllerCore->initContent() #6 /home/testsites/testnewversion/classes/Dispatcher.php(487): ControllerCore->run() #7 /home/testsites/testnewversion/index.php(78): DispatcherCore->dispatch() #8 {main} thrown in /home/testsites/testnewversion/modules/opayo/opayo.php on line 519 The order is processed, the payment is taken and order confirmation emails are sent. THe probelm is just in the display of this page. I can't find where I bought this module from. The module is 'Opayo (Formerly Sagepay) v4.0.0 - by Nethues Technology Pvt Ltd' The problem code is: if ($this->ps_below_7) { $total_to_pay = Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false); $order = $params['objOrder']; } else { $total_to_pay = Tools::displayPrice( $params['order']->getOrdersTotalPaid(), new Currency($params['order']->id_currency), false ); $order = $params['order']; } Tools::displayPrice() has been deprecated in v9.0 Is there a simple workaround to this? Edited September 10 by skinnybloke Issue solved (see edit history) Link to comment Share on other sites More sharing options...
ComGrafPL Posted September 10 Share Posted September 10 Test with this one: if ($this->ps_below_7) { $total_to_pay = Context::getContext()->getCurrentLocale()->formatPrice( $params['total_to_pay'], $params['currencyObj']->iso_code ); $order = $params['objOrder']; } else { $total_to_pay = Context::getContext()->getCurrentLocale()->formatPrice( $params['order']->getOrdersTotalPaid(), (new Currency($params['order']->id_currency))->iso_code ); $order = $params['order']; } 1 Link to comment Share on other sites More sharing options...
skinnybloke Posted September 10 Author Share Posted September 10 That works perfectly. Thank you for your help. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now