当前位置: 动力学知识库 > 问答 > 编程问答 >

Can users have their own product edit permissions in OpenCart?

问题描述:

I am completely new to OpenCart. I have created two users - user1 and user2 and both have the product add/edit permission. user1 add a product. But both user1 and user2 can edit the same product. What I am looking for is only user1 and superadmin can edit the product.

Likely if user2 adds another product then only superadmin and user2 can edit that product. Is it possible in OpenCart? If the situation is not possible in OpenCart, can anyone suggest an alternative to do the same?

网友答案:

Unfortunately, there is no such a thing in OC!

You have two options to accomplish that:

  • Find a plugin here that makes that (if any)
  • Code it manually
    • Step 1: you must keep track of the user who created the product, so you will need to add a new column to the <DB_PREFIX>_product table and save the id of the user who created the product in it, this is a simple step you will just need to modify the model function that saves the product details
    • Step 2: modify the get product model function and make it returns the id of the creator along with other data
    • Step 3: modify the edit product page controller index function in such a way that if the logged in user id does not equal the creator of the product, then display some error message
分享给朋友:
您可能感兴趣的文章:
随机阅读: