Skip to main content
Solved

Ability to hide 'child request' forms from the main catalog in portal v2


Forum|alt.badge.img+5

Does anyone know how to make the script from this thread work in portal v2?

I was using it in v1 to hide a category of child items that no one needed to see, but it doesn’t appear to do anything in v2.

Code for reference:

<script>
var cur_loc = window.location.pathname,
 req_loc = "/support/catalog/items";
if (cur_loc == req_loc) {
    jQuery(document).ready(function() {
      jQuery("#categories").find("[data-id='5000223941']").hide();
   }); }
</script>

 

Best answer by zachary.king

Here is a script that we use in the page layout that hides categories on the V2 Portal.

<!-- Hiding Categories -->
<script>
  jQuery(document).on('PageUpdate', function() {
	setTimeout(function() {
  	jQuery("[data-id='"+13000064493+"']").hide();
  	jQuery("[data-id='"+13000154178+"']").hide();
  	jQuery("[data-id='"+13000154048+"']").hide();
 }, 200);
 });
</script>

You would want to substitute the data-id with the id of the category you want to hide, but hopefully that helps :)

View original
Did this topic help you find an answer to your question?

4 replies

zachary.king
Skilled Expert
Forum|alt.badge.img+16
  • Skilled Expert
  • 951 replies
  • Answer
  • May 25, 2023

Here is a script that we use in the page layout that hides categories on the V2 Portal.

<!-- Hiding Categories -->
<script>
  jQuery(document).on('PageUpdate', function() {
	setTimeout(function() {
  	jQuery("[data-id='"+13000064493+"']").hide();
  	jQuery("[data-id='"+13000154178+"']").hide();
  	jQuery("[data-id='"+13000154048+"']").hide();
 }, 200);
 });
</script>

You would want to substitute the data-id with the id of the category you want to hide, but hopefully that helps :)


Forum|alt.badge.img+5
  • Author
  • Skilled Expert
  • 30 replies
  • May 25, 2023
zachary.king wrote:

Here is a script that we use in the page layout that hides categories on the V2 Portal.

<!-- Hiding Categories -->
<script>
  jQuery(document).on('PageUpdate', function() {
	setTimeout(function() {
  	jQuery("[data-id='"+13000064493+"']").hide();
  	jQuery("[data-id='"+13000154178+"']").hide();
  	jQuery("[data-id='"+13000154048+"']").hide();
 }, 200);
 });
</script>

You would want to substitute the data-id with the id of the category you want to hide, but hopefully that helps :)

Beautiful, works like a charm. Thank you very much!


zachary.king
Skilled Expert
Forum|alt.badge.img+16
  • Skilled Expert
  • 951 replies
  • May 25, 2023
tyler.brandt wrote:
zachary.king wrote:

Here is a script that we use in the page layout that hides categories on the V2 Portal.

<!-- Hiding Categories -->
<script>
  jQuery(document).on('PageUpdate', function() {
	setTimeout(function() {
  	jQuery("[data-id='"+13000064493+"']").hide();
  	jQuery("[data-id='"+13000154178+"']").hide();
  	jQuery("[data-id='"+13000154048+"']").hide();
 }, 200);
 });
</script>

You would want to substitute the data-id with the id of the category you want to hide, but hopefully that helps :)

Beautiful, works like a charm. Thank you very much!

My pleasure 😊


@zachary.king  this is awesome! To clarify, where did you put this script? In the footer? Also, were you able to get those items hidden from searches too?


Reply