Magento 限制供应商的产品激活
我有扩展超级简单多供应商市场免费。这用于多个供应商创建产品。这很有效 但是,当供应商创建一个产品时,我希望该产品被禁用。只有管理员才能激活它们Magento 限制供应商的产品激活,magento,Magento,我有扩展超级简单多供应商市场免费。这用于多个供应商创建产品。这很有效 但是,当供应商创建一个产品时,我希望该产品被禁用。只有管理员才能激活它们 是否有要修改文件的提示?好的,我找到了一个解决方案: 编辑文件app/code/core/Mage/Catalog/Model/Product/Status.php 添加此函数以获取用户的角色id: /** * get the role id of the logged in user */ static function role_id() {
是否有要修改文件的提示?好的,我找到了一个解决方案: 编辑文件app/code/core/Mage/Catalog/Model/Product/Status.php 添加此函数以获取用户的角色id:
/**
* get the role id of the logged in user
*/
static function role_id() {
$username = Mage::getSingleton('admin/session')->getUser()->getUsername();
$role_data = Mage::getModel('admin/user')->getCollection()->addFieldToFilter('username',$username)->getFirstItem()->getRole()->getData();
return $role_data["role_id"];
}
修改此功能以对不在管理组中的用户隐藏“已启用”下拉列表项:
static public function getOptionArray()
{
if (self::role_id() == 1) {
return array(
self::STATUS_ENABLED => Mage::helper('catalog')->__('Enabled'),
self::STATUS_DISABLED => Mage::helper('catalog')->__('Disabled')
);
} else {
return array(
self::STATUS_DISABLED => Mage::helper('catalog')->__('Disabled')
);
}
}
这一个是删除“--请选择--”内容:
玩得开心
static public function getAllOptions()
{
if (self::role_id() == 1) {
$res = array(
array(
'value' => '',
'label' => Mage::helper('catalog')->__('-- Please Select --')
)
);
} else {
$res = array();
}
foreach (self::getOptionArray() as $index => $value) {
$res[] = array(
'value' => $index,
'label' => $value
);
}
return $res;
}