eagleman Posted June 2, 2022 Share Posted June 2, 2022 Hello can you please help me with this issue, I need to display the total of orders on the client area section like {$orders_count} placed $this->context->smarty->assign(array( 'totalorders' => $totalorders, )); $this->setTemplate('customer/my-account'); Regards Link to comment Share on other sites More sharing options...
Ress Posted June 3, 2022 Share Posted June 3, 2022 Can you say the exact page where you want to post? My account page? 1 Link to comment Share on other sites More sharing options...
Prestachamps Posted June 3, 2022 Share Posted June 3, 2022 Hi @eagleman, for these two variables to be included into the \themes\YOURTHEME\templates\customer\my-account.tpl , you should create an override: override\controllers\front\MyAccountController.php and at this code to it: <?php class MyAccountController extends MyAccountControllerCore { public function initContent() { $orders_count = Order::getCustomerNbOrders($this->context->customer->id); $totalorders = Order::getCustomerOrders($this->context->customer->id); $this->context->smarty->assign( [ 'orders_count'=> $orders_count, 'totalorders'=> $totalorders ] ); parent::initContent(); } } Then clear cache and you can use these variables in your template:{$orders_count} and {$totalorders|dump} I hope that I could help. Have a nice day, Leo. 1 Link to comment Share on other sites More sharing options...
eagleman Posted June 3, 2022 Author Share Posted June 3, 2022 (edited) Hello @prestachamps it works like charm ; thank you very much for your time and your help Regards Edited June 5, 2022 by eagleman (see edit history) 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