php - How to edit user permissions only for selected fields on Opencart?


I've set up a non-admin user group on OC dashboard. Now I need to give permission for that user group to view and update all products but not to update Model and Quantity (only to view model and quantity). How could I do this?




It can't be done by default in OpenCart, you will need to look for an answer on the forums:

Or in the extension store:




Finally this is how I solved:

Added the following lines to admin/controller/catalog/product.php

$data['user_groups_id'] = $this->user->getGroupId();

Then updated admin/view/template/catalog/product_form.twig

{% if user_groups_id == 11 %}
  <input type="text" name="sku" value="{{ sku }}" placeholder="{{ entry_sku }}" 
   id="input-sku" disabled/>
{% else %}
  <input type="text" name="sku" value="{{ sku }}" placeholder="{{ entry_sku }}" 
   id="input-sku" />
{% endif %}

People are also looking for solutions to the problem: PHP require_once fails but require works


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.