Backend manager see his self-made orders only

  • Posts: 7
  • Thank you received: 0
9 years 1 week ago #220836

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.5
-- Error-message(debug-mod must be tuned on) -- : Non

Hi,

I want to make staff to see/edit their own orders only,
I use hikashop to manage orders which we create for customers via phone, So
1- I need to know which staff created this or that order. DONE
2- I want to make staff see and edit their own orders only. YET
3-I want to to edit any order to make it disappear from one staff to another. DONE - By Fabrik.

I made number one with no problem with this plugin + making No-List fields "id = id of who created order" "staff = name of who created id" through HikaCustomFields.

<?php
class plgHikashopstaff extends JPlugin {
	function plgHikashopName(&$subject, $config){
		parent::__construct($subject, $config);
	}
	function onAfterOrderCreate(&$order,&$send_email) {
           $user = JFactory::getUser();
	   $staff = new stdClass();
           $staff->order_id = $order->order_id;
           $staff->staff = $user->name;
           $staff->id = $user->id;
           $result = JFactory::getDbo()->updateObject('#__hikashop_order', $staff, 'order_id');
	}
}
?>

I tried to make number two but don't know where or how, I thought HikaDislplySomething should do but not sure,
Also tried to find the file which select order listing from DB didn't find it, Really complex for me.

I think code should like this, But where should I put it, Help me with this please,
If (access group is SuperUser){
Select all
}elseif (access group is Spical){
select where id =Joomla-Current-User-ID
}
Thank you

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 1 week ago #220839

Hi,

You can use the trigger "onBeforeOrderListing" for modifying the filters of the order listing in the backend.

function onBeforeOrderListing($paramBase, &$extrafilters, &$pageInfo, &$filters, &$tables, &$searchMap) { }

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

Time to create page: 0.034 seconds
Powered by Kunena Forum