Shopify Customized Search using external services

前提是你 提交于 2019-12-08 06:45:55

问题


My situation: we have a Shopify store, we also have a search engine implemented and hosted on AWS. We need to use that search engine instead of the default /search on our Shopify store.

Ideally, when users try to search something, their query (and potentially some other stuff like attribute selectors/checkboxes on the front end) will be passed to our search engine. Then after the result is back, they will be rendered at the front end.

My Question: how should I do this?

Option 1: modify the theme code, inject some javascript to call the search engine (Possible, but messy)

Option 2: write an app, wrap my search engine within the app, and somehow plug it in the store (I don't know how to do this)

Option 3: similar to Option 1, but write an app, use the app to inject some code to the theme, and somehow handle the work. (I don't know how to do this either)

I found a similar post here: Write custom search app in shopify but the answers below were more about filtering/modifying search result returned by the default shopify engine, I want to instead use my own search engine.


回答1:


Essentially my problem was to redirect user search queries to my service, and eventually render search results on user front end. To do that i have found the best way was to write a Shopify App.

Here is my solution:

1, build an App, host it somewhere maybe ngrok, install it on the store: (https://help.shopify.com/api/tutorials)

2, use proxy to redirect the /apps/mysearch to where the App is hosted: (https://help.shopify.com/api/tutorials/application-proxies)

3, in the store, show users a form where action="/apps/mysearch".

4, in the app process the form data, do whatever we want. Eventually return a view back to the store containing the search result, be sure to specify "Content-Type: application/liquid" inside of the app so that the returned view works with shopify theme.

Note that all of the search happens outside of Shopify.




回答2:


I think you should do this with Option 1. Though its messy but it work and save your time. You can also hire an shopify developer ( like me ) for help.



来源:https://stackoverflow.com/questions/45927777/shopify-customized-search-using-external-services

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!