Build UI
Modify Response

Overview

6min
modify response to modify a search response, the incoming response object is intercepted and any of the available datapoints can be manipulated as needed prior to being sent to the ui templates there are two steps intercept the incoming response object identify the data object to be modified intercept the response object any of the product attributes are available to be modified as needed or otherwise inject any custom values use the klevu modifyresponse function to intercept the response data klevu modifyresponse ("\<scope>", "\<callback>"); identify the data object the simplest way to get acquainted with the available data is to use console log and review the output klevu modifyresponse("landing", function(data, scope){ console log('klevu modifyresponse', data); }); for example, the following snippet loops through each record in the productlist result and outputs the product object to the browser's developer console log klevu modifyresponse("all", function(data, scope){ klevu each( data template query productlist result , function(indx, product) { console log('klevu response product ' + indx, product); }); }); determining scope note that each klevu modifyresponse function requires definition within the corresponding scope of the override we will chart these below scope description all applies to all scope modules quick quicksearch module landing srlp module catnav category module full page both srlp and category modules (same as "landing,catnav") multiple klevu modifyresponse functions can be applied in the same or mixed scope examples please see the modify response examples docid\ y x07x1pw9dow thixcdl section for details of common uses