How can I get customer number of orders on customer order page on public store. I have seen that already exist on admin page bu is there any setting that should be activated as this can be shown on public store.
How can I get customer number of orders on customer order page on public store. I have seen that already exist on admin page bu is there any setting that should be activated as this can be shown on public store.
Assuming the controller you are using has the
_storeContext
,_workContext
and_orderService
variables injected, this will do it:If any of those variables don't exist, manually add them to your controller. Toy need to add the private variables:
Extend the constructor of the controller and add in the code to save the injected values: