Hi,
How to track all the Admin Activity on Frontend when he Logged In as Customer.
Please suggest any solution.
Use following code
protected $_customerSession; public function __construct( \Magento\Customer\Model\Session $customerSession, ) { $this->_customerSession = $customerSession; } public function getGroupId(){ if($this->_customerSession->isLoggedIn()): //Get current group echo $this->_customerSession->getCustomer()->getId(); // get customer id echo $this->_customerSession->getCustomer()->getName(); // get customer Full Name echo $this->_customerSession->getCustomer()->getEmail(); // get customer Email else: echo “no logged in”; endif; }
You have given the customer session, but i need the admin logged in as vendor in frontend.
And need to track the admin activity on frontend.
For Admin activity on Backend we are having a free extension KiwiCommerce_AdminActivity, but i need the track of admin on frontend when he logged in as customer.
Here first we need to carry admin session or anything (please suggest) to know that the logged into customer account is an admin.
@Kiran
If you are using marketplace extension then it is using the customer session not admin session. This is correct code for you. you can check it customer group is vendor. Then you track that user information.
Hi @qaisar_satti
When trying to use your code $customerSession i am getting the following Fatal Error:
Fatal error: Uncaught Error: Call to a member function create() on null
Please suggest.
And also can you help me with code for the below words:
you can check it customer group is vendor. Then you track that user information.
Following this tutorial you will get customer group information. As far error concern can you send or share code with me
current customer group