Allowing non-Admins to Edit the Product Catalog

sugarcrmdevelopers —  December 27, 2011

Products, Product Bundles, Product Templates (a.k.a. Product Catalog) are handled somewhat obscurely in SugarCRM. Things aren’t exactly what they first seem, and may require a proper explanation. You may quickly realize that users that normal system users have no access to the Product Catalog (the ProductTemplates module).

And what’s more, attempting to use Roles to open up this access is fruitless, as Product Catalog isn’t listed! The trick is a dash of well-tuned SQL and a one-liner that makes the Product Catalog Tab available.

When Roles are created, they read from a list of actions held in the acl_actions table. We need to add rows to this table for each Product Catalog action (admin, access, view, delete, etc).

insert into `acl_actions` (id,name,category,acltype,aclaccess,deleted) VALUES

Now you can adjust any given role to give users the ability to work with the Product Catalog. It’s still a bit finicky though. Due to the nature of Products and ProductTemplates, for a user to work with the Catalog the Role must have full, across-the-board Admin/Developer access to both Products and the Product Catalog.

Product Catalog in the Roles Menu

Now, that access doesn’t do us much good if we can’t actually access the Catalog. By default, the only link is within the Admin screen. Most users would prefer the more typical module tab. To get this, create a file custom/Extension/application/Ext/Include/ProductTemplates.php with the contents

$moduleList[] = 'ProductTemplates';

Do a Quick Repair and Rebuild so the system will pick up that there’s a new Tab in town. Then the Product Catalog tab will be available for manipulation through the usual means, the “Display Module Tabs and Subpanels” screen.

Product Catalog in the Display Tabs screen

I’ve created a Module Loader-capable package that will do the SQL insert and ProductTemplates.php for you. All you have to do is install the module and run a Quick Repair and Rebuild to have mostly normal access to the Product Catalog. Download it now.