magento用户只能看到他的产品 [英] magento user can see his product only

查看:52
本文介绍了magento用户只能看到他的产品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是magento的新手.我已经创建了用户角色商人,并创建了名为 stockuser1 的用户.现在,他也可以看到管理员添加的产品.我应该如何限制他只能看到他添加的产品?
预先感谢.

I am new in magento. I have created user role merchant as well as create user named stockuser1. Now he can see product added by admin too. How should I restrict him that he can see product added by him only?
Thanks in advance.

推荐答案

一种简单的方法是,通过创建一个属性product_user并定义其中的所有用户,然后将该属性分配给您的功能属性集.您必须为每个产品分配一个用户,然后将app\code\core\Mage\Adminhtml\Block\Catalog\Product\Grid.php复制为app\code\local\Mage\Adminhtml\Block\Catalog\Product\Grid.phplocal文件夹 添加以下行:

A simple way to achieve this is, by creating an attribute suppose product_user and define all the users in it, then assign this attribute to your functional attribute set. you have to assign each product a user, then copy the app\code\core\Mage\Adminhtml\Block\Catalog\Product\Grid.php to local folder as app\code\local\Mage\Adminhtml\Block\Catalog\Product\Grid.php add the following lines:

$admin = Mage::getSingleton('admin/session')->getUser();
if($admin->getUsername() !='your actual admin'){
     $collection->addAttributeToFilter('product_user', $admin->getUsername());
}

在功能_prepareCollection()

希望这可以,但是我还没有测试.

Hope this will work but I haven't tested.

这篇关于magento用户只能看到他的产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆