Skip to main content

How to get user name/id in order history

More
15 years 6 months ago - 15 years 6 months ago #9708 by mett
Hello,

I just bought business version and found a lot of interesting features in this version. What i can't find is how and where to get the user id or name of user who modified the status of an order. In my case, i'm just the administrator of website but orders are processed by other peoples (editors). Would be great to see this info (editors names) in orders history area instead of (or near) IP column for example.

Here is what i tried so far: in administrator/com_hikashop/plg_hikashop_history/history.php i added in

function onAfterOrderUpdate(&$order,&$send_email){

$user =& JFactory::getUser();
if ($user->get('id') > 0) {
$utilizator = $user->get('id');
}
$history->history_user = $utilizator;

i created a field history_user in table but i dont' get the value in..

Thank you
Last edit: 15 years 6 months ago by mett.

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #9719 by nicolas
There is no $history variable. It should be:
$order->history->history_user = $utilizator;

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #9721 by mett
i don't know what i'm doing wrong:

function onAfterOrderUpdate(&$order,&$send_email){
$user =& JFactory::getUser();
if ($user->get('id') > 0) {
$utilizator = $user->get('id');
}
$order->history->history_user = $utilizator;
if(!empty($order->order_id)){
....

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #9722 by nicolas
You need to implement the function onBeforeOrderUpdate and not onAfterOrderUpdate so that the information is saved along the order. Also, you should have the history plugin published with an ordering greater than your plugin so that the information is already there when the history plugin saves the information.

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago - 15 years 6 months ago #9728 by mett
Nicolas, can you please take a look at attached plugin? It's my first plugin, so please be gentle :D

This attachment is hidden for guests.
Please log in or register to see it.

Last edit: 15 years 6 months ago by mett.

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #9732 by nicolas
You will need to modify the history plugin and change the code:

$history->history_reason = @$order->history->history_reason;
$history->history_notified = @$order->history->history_notified;
$history->history_amount = @$order->history->history_amount;
$history->history_package_id = @$order->history->history_package_id;
$history->history_payment_id = @$order->history->history_payment_id;
$history->history_payment_method = @$order->history->history_payment_method;
$history->history_data = @$order->history->history_data;
$history->history_type = @$order->history->history_type;

to:

foreach(get_object_vars($order->history) as $k => $v){
$history->$k = $v;
}

so that the new columns are taken into account by the history plugin. We'll do the modification on our end too so that you won't have problems next time you update.

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago - 15 years 6 months ago #9735 by mett
I will wait for next update because i can't make it work, i modified the original history plugin but still don't get any value in history_user column. Please note that i created this column using phpmyadmin, not using custom fields option.
Last edit: 15 years 6 months ago by mett.

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #9736 by nicolas
It will be faster for us to directly integrate that function without any plugin. It will be in next version.

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #9792 by mett
May i ask when you will release a new update? We would like to start using hikashop but we can't without this option( i don't want to rush you, just asking for a time frame)

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #9815 by nicolas
We don't have a defined date yet. We however do a release every two weeks approximately and we did last release on sunday.

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #10819 by mett
Hello Nicholas,

Any chance to get this update? We can't start our shop without this option available...

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #10840 by nicolas
We are still in the middle of the modifications to get next version out. In the mean time, we can propose you a pre version if you contact us via our contact form: www.hikashop.com/en/support/contact-us.html

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #10904 by mett
Nicholas, thank yout for sending me this pre version..unfortunately, i can't find this option available..where should i look? I don't see any new column in order history..

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #10912 by nicolas
In the order history, instead of the column IP, you should now have a column user/IP with both information.

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #10913 by mett
Nope, is not there; not even "reason" field is not recorded

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #10915 by nicolas
Since we didn't change the version number in the package, the query to modify the history table wasn't run during the update process. Please runt he query below in your phpmyadmin and then try a new order:
ALTER TABLE `jos_hikashop_history` ADD `history_user_id` INT UNSIGNED DEFAULT 0

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #10916 by mett
still not visibile in site, but is recorded in database..

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #10917 by nicolas
If you customized the order view, you need to remove the customization since Hikashop does not remove your views customizations when you update it.

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #10919 by mett
thank you, was a template problem :)

Please Log in or Create an account to join the conversation.

Time to create page: 0.323 seconds
Powered by Kunena Forum