cancel
Showing results for 
Search instead for 
Did you mean: 

How customize compare view of Product cockpit

Former Member
0 Kudos

i need to change the format of date attribute which is displayed in compare view can anyone help me where is the source for compare view so that i can customize .

Accepted Solutions (1)

Accepted Solutions (1)

unglaube
Advisor
Advisor
0 Kudos

I just copied code from CompareMainAreaBrowserComponent and changed the CompareView to my CustomCompareView. And sorry - I have to correct myself: I extended the AbstractMainAreaBrowserComponent and not the CompareMainAreaBrowserComponent !

Not a very nice approach , but it worked.

Answers (1)

Answers (1)

unglaube
Advisor
Advisor
0 Kudos

Hi natha, unfortunately it's not so easy to customize the product cockpit because it contains a lot of hard coded logic. I had to customize the compare view some time ago - there was a requirement to display values of a collection with line breaks. This was my solution in the end:

  1. Create a new custom SearchBrowserModel that extends the DefaultProductSearchBrowserModel.

  2. Declare this new model in your web-spring.xml using the alias "DefaultProductSearchBrowserModel".

  3. Create a new class for your custom view mode.

  4. Create a custom CompareMainAreaBrowserComponent that extends the AbstractMainAreaBrowserComponent and that uses your new CompareView.

  5. Create a custom CompareMainAreaComponentFactory that extends the CompareMainAreaComponentFactory and overrides the createInstance() method: This method should return your custom CompareMainAreaBrowserComponent.

  6. Override the method public List getAvailableViewModes() of the parent class DefaultSearchBrowserModel in your CustomBrowserModel and add the new CompareMainAreaComponentFactory.

  7. Create a custom CompareView and change the calling methods, e.g. the renderValue() method to your needs.

Hope, this helps.

Former Member
0 Kudos

Thank you , can you please describe 4th point how to use my customCompareView inside CompareMainAreaBrowserComponent .