- 11
I need to customize Instant Search plugin for nopcommerce 3.9.
I have hijacked the call to InstantSearch to my own controller, and planning to add a few extra fields in the json response. But can't figure out what my controller should return. I always get error that it can't read property of null.
What should my controller return?
It looks something like this atm.
I have hijacked the call to InstantSearch to my own controller, and planning to add a few extra fields in the json response. But can't figure out what my controller should return. I always get error that it can't read property of null.
What should my controller return?
It looks something like this atm.
[HttpGet]
public ViewResult GetAllCategoriesByProductSearchTerm(string q)
{
var path = Url.RouteUrl("InstantSearch");
var urlBuilder =
new System.UriBuilder(Request.Url.AbsoluteUri)
{
Path = path,
Query = $"q={HttpUtility.UrlEncode(q)}"
};
string url = urlBuilder.ToString();
var json = new WebClient().DownloadString(urlBuilder.ToString());
return JArray.Parse(json);
}