3

I am working on a project where I need to add a custom user from the magento admin panel. This user cannot purchase the products. He can only login to his section and write reviews on products or update his/her profile information. Magento admin should be responsible for creating this user with his username and password and other details. Please, help regarding this I really have no idea of the best practices when it comes to creating entity that is managed from the admin panel. Thanks in advance.

1

First add new customer group

customer > manage group > Add New Customergroup

then create user and assign group to that customer

customer > manage customer > Add New Customer

To restrict customer to add to cart use this event

<checkout_cart_update_items_before>
<observers>
<cart_update>
<type>singleton</type>
<class>auction/observer</class>
<method>updatebeforeCart</method>
</cart_update>
</observers>
</checkout_cart_update_items_before>

check if customer belong to that user group

if(Mage::getSingleton('customer/session')->isLoggedIn()) {
$customerData = Mage::getSingleton('customer/session')->getCustomer();
$customerId=$customerData->getId();
$customer = Mage::getModel('customer/customer')->load($customerId);
$customer->getGroupId();
}

throw exception same as for the review add check for that if user belong to that group then add review..

  • @ Qaisar Satti : how I can add the custom fields for the customer because I don't need the default fields provided by the magento in the case of this custom users. Those default fields can be use for the normal users who purchase products. I also want to add a field for the profile image for this user. Please, advise how I can achieve this. Thanks – mudit mehrotra Aug 24 '16 at 10:23
  • @muditmehrotra you have to create custom customer attributes. you Google it there is lot of help about this topic. – Qaisar Satti Aug 24 '16 at 10:25
  • I need to add different fields for this customer inside the admin panel when magento admin going to create this customer and default fields should be show only for the normal customer creation from the admin. Is it possible? – mudit mehrotra Aug 24 '16 at 10:54
  • yes if you create the custom customer attribute that will show in admin panel by default. – Qaisar Satti Aug 24 '16 at 10:58
  • I need to show the posts from facebook, twitter, instagram for the user on his profile page so how I can achieve this. As per my thoughts I need to create a controller and on controller's action I need to paas the id of the user to fetch the details and social media profile urls from the database then paas this to view to render all. but I am not getting how I can integrate the social media accounts there on his profile page. Please help – mudit mehrotra Aug 25 '16 at 9:28
0

Please try Magento user roles/permission. create one roles with product add / edit and review add /edit then create user in admin set that role.

  • @ Prashant Barot : thanks for your comment. Yes I can create user by using the Magento user roles/permission but there are some custom fields which I also need to add for that user like description, his social media accounts and I need to show the post from these account on this user's profile page. This user should login from the front end(not from magento admin)to add comments on products and to update his/her profile information which magento admin added so there should be an custom space for this user to add/update all this stuff. How I can handle this? I am a new to magento. – mudit mehrotra Aug 20 '16 at 6:36
  • any comments about my query? – mudit mehrotra Aug 22 '16 at 2:59

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.