0

I need to make happen following:

  • I have five admins that can only access "Customer" area
  • They are adding customers to buy in the front end
  • Customers are divided into five groups

I need to make the process of adding users so it excludes choosing to which group customer is added but it needs to be added automatically based on which admin is adding the user.

2

Create a custom module with an observer for adminhtml_customer_save_after

In config.xml

<events>
    <adminhtml_customer_save_after>
        <observers>
            <magepal_admincustomergroup>
                <type>model</type>                           
                    <class>admincustomergroup/observer</class>
                    <method>saveAdminCustomerGroup</method>
            </magepal_admincustomergroup>
        </observers>
    </adminhtml_customer_save_after>
</events>

In your observer

public function saveAdminCustomerGroup(Varien_Event_Observer $observer)
{

    $customer = $observer->getCustomer();

    $user = Mage::getSingleton('admin/session');
    $userId = $user->getUser()->getUserId();

    //check current admin user info and set customer group
    // $customer->setData( 'group_id', 5 ); 
    // save customer

    // may want to check if customer already assign to a group
}
  • How can I tell it which admin is adding user to which group? – Dino Aug 27 '14 at 8:48
  • 1
    $user->getUser() contain all the admin user info... see blog.chapagain.com.np/… – Renon Stewart Aug 27 '14 at 12:54
0

Yo can create an observer for the event adminhtml_customer_save_after, see the logged user and act consequently.

  • Please be more specific and elaborate, I'm not so advanced with Magento platform. – Dino Aug 8 '14 at 13:45
  • The entire process you want to follow without your custom logic is here: magento.stackexchange.com/questions/15155/… – mbalparda Aug 8 '14 at 13:47
  • Link is not helping me at all... I'm just trying to understand that if there is a way to disable the selection of customer groups when adding the customer and make that customer part of group based on the admin adding the customer.. – Dino Aug 8 '14 at 14:25
  • Like if one admin is named "manager1" it adds to corresponding group automatically. – Dino Aug 8 '14 at 14:26
  • There is no way to do what you want without a pretty extensive knowledge in Magento since its not a core feature and as far as i saw, there is no extension for this. The links so far have everything you need but you also will need to fully understand how Magento works in order to accomplish what you need. – mbalparda Aug 8 '14 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.