contextual search how can I configure this button?

andy_dufresne
Tera Expert

Hello,

I have a contextual search, when a user searches it gives a list of "record producers".   The user wants to simple click on the link and it should take him to the required 'record producer'.

So I want to get rid of this button "Take Me To Form" [which does the right job, but want the url link before it to do the job]

find_real_file.png

I have searched everywhere in the contextual search and record producers, but cannot locate this "Take Me To Form" button.

1 ACCEPTED SOLUTION

Hi Andy.



You can get rid of the button with a catalog client script. Please be aware though, when you upgrade, there may be changes to Contextual Search could break your script. You'll be able to see if we've changed anything in contextual search in the release notes though.



This is the script:


function onLoad() {


      document.observe("cxs:target_update", function() {


              $$("#cxs_results_container button.request_catalog_button_with_icon").each(function(elem, index) {


                      elem.hide();


              });


      });


}



The event cxs:target_update is fired each time a search is completed.



This is what my catalog client script looks like:


find_real_file.png



This will only work on your record producer. If you wanted to do hide the Order button when displaying contextual search results on a form you would need to create an onLoad client script there too. The however should be the same.



Let me know if this works for you.



Thanks,



Cameron


View solution in original post

16 REPLIES 16

Ahh, this issue is mine...



function onLoad() {


        document.observe("cxs:target_update", function() {


                  $$("#cxs_results_container a.service_catalog").each(function(elem, index) {


                            var orderButtons = elem.adjacent(".request_catalog_button_with_icon");


                            if (orderButtons.length == 0)


                                      return;



                            var orderButton = orderButtons[0];


                            orderButton.hide();



                            elem.on("click", function(event) {


                                      event.stop(); // Stop the event from bubbling and from performing its default action


                                      window.location = orderButton.readAttribute("data-url"); // Change the windows location to the hidden button's URL


                            });


                  });


          });


}



I hadn't passed in the event into the click event callback ( elem.on("click", function(event) { )



I've checked it in Firefox and it's working as expected. I rechecked Chrome just to be sure.



Thanks,



Cameron


andy_dufresne
Tera Expert

Thank you!



You make   'Contextual Search' a pleasure to work!