VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: EvanGR on November 22, 2019, 09:21:40 AM

Title: [SOLVED] Change order status, display user who performed the action
Post by: EvanGR on November 22, 2019, 09:21:40 AM
We have 2+ sales people (i.e. joomla users) which handle orders in VM. We want to see the user who performed each order status change.
Is this information stored/available in the system?

We can do the template override if it's accessible. Thanks
Title: Re: Change order status, display user who performed the action
Post by: AH on November 22, 2019, 10:09:37 AM
It really depends where you want to see this information

In the orders table modified_by gives the user id that last modified the order - but that might not be what you are looking for as there may be many statuses set in the life of an order

If you want to see the detail for every status in the order detail screen

The order detail contains the status data along with the "virtuemart_order_histories" table data which holds the user_id that set the status in created_by modified_by fields

This can be looked up in the joomla "users" table to get the corresponding name

You could probably do this by loading the virtuemart user model and getting user details using a function within that model

If the user_id is sufficient  - then a view override would probably be sufficient

Once you have the variable populated - you can display


Title: Re: Change order status, display user who performed the action
Post by: EvanGR on December 03, 2019, 15:54:32 PM
Thanks.... I am almost there in creating the ideal override.

One thing missing... how do I get the user object, from the user_id? (from within the order.php template)
I need it to display the username for each order status update.
A specific code example would be very much welcome.

Thanks!
Title: Re: Change order status, display user who performed the action
Post by: Milbo on December 03, 2019, 17:29:19 PM
JFactory::getUser($order->created_by) or so.
Title: Re: Change order status, display user who performed the action
Post by: EvanGR on December 11, 2019, 12:04:59 PM
Thank you, it worked.