Page 2 of 2

Hiding unused columns on admin site

Posted: Fri Feb 14, 2014 6:52 pm
by csrinivasrao
Hi All,

I created a sub class of ProductImpl as MyProductImpl. I would like to remove the manufacturer default category and sale price from search list and replace with my custom properties from MyProductImpl. I tried to override as below but it is not working.

Code: Select all

@AdminPresentationMergeOverrides({
      @AdminPresentationMergeOverride(name = "manufacturer", mergeEntries = {
            @AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.VISIBILITY, stringArrayOverrideValue = Presentation.Tab.Name.Advanced),
            @AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.TABORDER, intOverrideValue = Presentation.Tab.Order.Advanced),
            @AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.GROUP, stringArrayOverrideValue = Presentation.Group.Name.Advanced),
            @AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.GROUPORDER, intOverrideValue = Presentation.Group.Order.Advanced), })
   })


from an another post https://github.com/BroadleafCommerce/Br ... issues/145, sounds like this is designed behaviour.

I'm just wondering whether it is possible to replace ProductImpl with MyProductImpl and completely remove unused fields.

Thanks,

Srinivas Rao

Re: Hiding unused columns on admin site

Posted: Mon Feb 17, 2014 11:36 am
by phillipuniverse
Use the @AdminPresentationClass annotation like this:

Code: Select all

@AdminPresentationClass(ceilingDisplayEntity "com.mycompany.core.domain.catalog.CustomProductImpl")
 


This will ensure that every time you hit the 'Add New Product' button in the admin, you will always be adding instances of CustomProductImpl and never just ProductImpl.

ALso,

Code: Select all

@AdminPresentationMergeOverride(name "manufacturer"mergeEntries = {
    @
AdminPresentationMergeEntry(propertyType PropertyType.AdminPresentation.EXCLUDEDbooleanOverrideValue=true)
})
 


All of the values for propertyType come from the @AdminPresentation annotation. The above code would be equivalent to writing:

Code: Select all

@AdminPresentation(excluded true)
 



What you had written would be equivalent to doing:

Code: Select all

@AdminPresentation(visibility "Advanced"tabOrder 7000group "Advanced"groupOrder 1000)
 


This doesn't hide anything and is really just moving the field around on the page. For visibility specifically, the visibility field of @AdminPresentation expects a 'VisibilityEnum' value.

Re: Hiding unused columns on admin site

Posted: Tue Feb 18, 2014 5:51 pm
by csrinivasrao
Many thanks Philip. It works and very neat approach :D

Thanks,

Srinivas Rao