gonebdg - webindoshop.com Posted January 25, 2021 Share Posted January 25, 2021 Does anyone know how to call Class method inside OrderController.php > viewAction ? For example, I'm trying to get the related order message from db table `ps_message` with this method $message = Message::getMessagesByOrderId($orderId); But it's error Link to comment Share on other sites More sharing options...
gonebdg - webindoshop.com Posted January 26, 2021 Author Share Posted January 26, 2021 Anyone ??? The reason I would like to do this is because I couldn't get the order message from `ps_message` DB table from this code $debug_message = $orderForViewing->getMessages(); dump($debug_message); exit; Link to comment Share on other sites More sharing options...
gonebdg - webindoshop.com Posted January 28, 2021 Author Share Posted January 28, 2021 Hmmm ... I'm not sure what is wrong with my dev site on live server because in my locahost the order message was displayed normally and the debug code show the messages as it should. However I still can't figuring out how to call class method inside Prestashop > Symfony controller ... $debug_message = $orderForViewing->getMessages(); dump($debug_message); exit; Link to comment Share on other sites More sharing options...
gonebdg - webindoshop.com Posted January 28, 2021 Author Share Posted January 28, 2021 Ok please forget about order message issue, since I already figuring out what is the cause of the problem.NOTE: order message issue in here are happened on Dev Site which are the upgraded version from an old PS version the related/necessary data are missing from the database which cause order message are not displayed on admin order Back to the topic of this thread which is "How to call class method in OrderController ?" I guess since PS 1.7.7.0 we can't call Prestashop class method anymore directly from PS-symfony controller we had to override the related controller by creating custom module and then call PS class method from there If someone know how to call Prestashop class method (directly) inside PS-symfony controller please let me know how ... Link to comment Share on other sites More sharing options...
gonebdg - webindoshop.com Posted February 4, 2021 Author Share Posted February 4, 2021 PROBLEM SOLVED Basically it's so simple ... but sometime forgotten OrderController.php yet declare the necessary class which require to call the corresponding class method. So simply (add) declare following code in the top of the file along with the available code declarations use Db; use PrestaShopDatabaseException; 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