使用外部服务Shopify定制搜索 [英] Shopify Customized Search using external services

查看:158
本文介绍了使用外部服务Shopify定制搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的情况:我们有一个Shopify商店,我们还有一个在AWS上实施和托管的搜索引擎。我们需要在Shopify商店中使用该搜索引擎而不是默认/搜索。

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?

选项1:修改主题代码,注入一些javascript来调用搜索引擎
(可能,但很乱)

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

选项2:写一个应用程序,将我的搜索引擎包装在应用程序中,并以某种方式将其插入商店
(我不知道该怎么做)

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)

选项3 :类似于选项1,但编写应用程序,使用应用程序向主题注入一些代码,并以某种方式处理工作。
(我不知道怎么做)

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)

我在这里发现了类似的帖子:在shopify中编写自定义搜索应用程序
但下面的答案更多是关于过滤/修改默认shopify引擎返回的搜索结果,我想使用我自己的搜索引擎。

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.

推荐答案

基本上我的问题是将用户搜索查询重定向到我的服务,最终在用户前端渲染搜索结果。要做到这一点,我发现最好的方法是编写Shopify应用程序。

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.

这是我的解决方案:

1,构建一个应用程序,托管它可能是ngrok,将其安装在商店:( https:// help.shopify.com/api/tutorials

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

2,使用代理将/ apps / mysearch重定向到托管应用的位置:( https://help.shopify.com/api/tutorials/application-proxies

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

3,在商店中,向用户显示一个表单,其中action =/ apps / mysearch。

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

4,在app处理表单数据,做我们想做的事。最终将视图返回到包含搜索结果的商店,请务必在应用程序内指定Content-Type:application / liquid,以便返回的视图与shopify主题一起使用。

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.

请注意,所有搜索都发生在Shopify之外。

Note that all of the search happens outside of Shopify.

这篇关于使用外部服务Shopify定制搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆