cancel
Showing results for 
Search instead for 
Did you mean: 

disable/remove create new item button in product cockpit

Former Member
0 Kudos

Please help me to disable/remove the "+" plus icon which is used to create new products in product cockpit. I just changed the below properties in project.properties in productCockpit, which did not help out. productcockpit.default.contextarea.toolbar.enableNewItemButton=false productcockpit.default.contextarea.list.hideNewItemButton=true

Please do the needful. PFA the required screenshot

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

In addition to the above solution, only Admin user is allowed to create a product, this is achieved with conditioning the user currently logged is an Admin or not.

Answers (2)

Answers (2)

Former Member
0 Kudos

You can also overwrite the DefaultProductSearchBrowserModel:

 @Override
 public boolean isShowCreateButton()
     {
         return false;
     }


 <alias alias="DefaultProductSearchBrowserModel" name="yourownProductSearchBrowserModel"/>
     <bean id="yourownProductSearchBrowserModel" class="your.own.ProductSearchBrowserModel"
           scope="prototype" parent="AbstractPageableBrowserModel">
     </bean>
Former Member
0 Kudos

Hi , The said solution is a feasible solution, but this component get disabled for Admin user also. But we need to allow the Admin user to create a product. How this can be done? It could be better if you could help me understand as why the first approach of adding the properties doesn't work too.

Former Member
0 Kudos

You could write logic in the isShowCreateButton.

 if (userService.isAdmin(userService.getCurrentUser()))
     {
             return true;
     }
Former Member
0 Kudos

Did you overwrite the productcockpit extension with your own extension? Because then the properties should be added like this :

 yourextensionname.default.contextarea.toolbar.enableNewItemButton=false
 yourextensionname.default.contextarea.list.hideNewItemButton=true
Former Member
0 Kudos

I tried the above steps but still + is shown in custom cockpit and i could create product when i click on it. Let me know any other steps to be followed

Former Member
0 Kudos

My own extension is extending productcockpit. I added the said properties in project.properties of my own extension, still it's not reflecting. User is able to create a product. Please help us out, as what's the wrong with this.