Jump to content

Display nb of orders on my-account


Recommended Posts


can you please help me with this issue, I need to display the total of orders on the client area section 



{$orders_count} placed



            'totalorders' => $totalorders,






Link to comment
Share on other sites

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:

class MyAccountController extends MyAccountControllerCore
    public function initContent()
        $orders_count = Order::getCustomerNbOrders($this->context->customer->id);
        $totalorders = Order::getCustomerOrders($this->context->customer->id);
                'orders_count'=> $orders_count,
                'totalorders'=> $totalorders

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.

  • Thanks 1
Link to comment
Share on other sites

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