Substitute com.glideapp.servicecatalog_category_view with com.glideapp.my_custom_view

Greg42
Mega Guru

Hi All,

I am trying to change the way items/categories are displayed it a catalogue - namely, to display it as a grid not a list. I don't want to change existing code from obvious reasons. I did some research and looked around the system of how those thing work together but can't see where the link item - using SNC.CatalogURLGenerator - generates com.glideapp.servicecatalog_category_view - can't see source code for it anywhere. I would like to change it to my custom view allowing me to work on it without worrying about future updates.

Is there a way to change the path generated by CatalogURLGenerator to point somewhere else than default com.glideapp.servicecatalog_category_view?

Any help will be much appreciated.

Cheers

Greg

1 ACCEPTED SOLUTION

Greg42
Mega Guru

I have managed to style the view as I wanted. Used addLoadEvent and checked for com.glideapp.servicecatalog_category_view.do then used jQuery for styling.


View solution in original post

39 REPLIES 39

Hello Greg,



Thank you for the code. I have achieved the output but categories are misplaced regardless of alphabetical order. Could you please suggest me how can i place them in Alphabetical order?



Regards,


Jag.


Hi Jaganath,



You need to make sure that the ordering on items and categories is set correctly. Remember that the whole set that is returned from the back-end is sorted by order and iterated through on the front-end by adding each element to a column based on its order(index).



This is where it's decided which "bucket" should an item be placed in:


if (items && (itemsIndex !== index)) {


        if (index % num_of_cols) {


                  itemRows.find("table.wide").eq(0).append(value);


        } else {


                  itemRows.find("table.wide").eq(1).append(value);


        }


}



Example setup:


alpha.pngsetup.png



Now there is a small issue you can notice on the first screen. You see that Executive Desktop is out of place. You might bump into that when you have child categories in your main category. You just need to go to child items and adjust the order accordingly.



The other solution would be to add sorting on the front-end and completely ignore the ordering but that's up to you.



Hope that helps.




Cheers



Greg


Hello Greg,



Thank you for your reply. I am able to sort the order now correctly.


I am trying to increase the no.of columns to 4   so that all my categories will fit in the screen and users won't need to scroll down. I have tried changing in line:4. Do i have to change anywhere else?



Thanks & Regards,


Jag.


Hi Jaganath,



Unfortunately this code won't split to more than two columns without rewriting. It was something that was planned for the second phase but I was pulled to another project and haven't had a chance to come back to it - later moving to a different company so basically this code stayed as is it in my archive. I might come back to it in some future time but currently I'm very busy with work and my private projects. Feel free to adjust the code to your needs though.




Cheers



Greg


Thank you Greg. No problem.



Regards,


Jaganath.