davidhirtz / yii2-shopify
基于Yii 2.0框架的Shopify模块,适用于管理面板
Requires
- davidhirtz/yii2-skeleton: ^2.3
Requires (Dev)
README
基于Yii 2扩展yii2-skeleton的Shopify后端。
Shopify设置
首先,在Shopify管理后台的Apps
> Develop apps
> Create an app
下创建一个自定义应用程序。完成创建后,需要配置应用程序以允许至少以下Admin API访问范围
read_inventory
read_products
要使用Storefront API(shopify.js),需要激活Storefront API集成并授予以下权限
unauthenticated_write_checkouts
unauthenticated_read_checkouts
unauthenticated_write_customers
unauthenticated_read_customers
unauthenticated_read_product_listings
unauthenticated_read_product_inventory
凭证
以下Shopify凭证需要添加到config/params.php
中,或者直接在davidhirtz\yii2\shopify\Module
中设置属性。它们可以在Shopify管理后台的私人应用程序设置下的API credentials
中找到。
shopifyShopName The shopify name of your shop (https://NAME.myshopify.com/)
shopifyShopDomain Your optional custom shop URL
shopifyApiKey API key (API key and secret key)
shopifyApiSecret API secret (API key and secret key)
shopifyAccessToken Admin API access token (IMPORTANT: Can only be accessed once!)
shopifyStorefrontAccessToken Storefront access token
Webhooks
配置完成后,转到Products
> Webhooks
(需要Manage Shopify webhooks
用户权限)并点击Install Webhooks
以注册必要的webhooks,这些webhooks将Shopify管理后台与网站同步。
产品
产品在Shopify管理后台更改时会自动同步。如果Webhooks注册之前已创建产品,或者同步似乎存在问题,请点击Reload Products
从Shopify加载所有产品。
Shopify主题
要禁用后端中的“在线商店”应用程序,您可以创建一个最小主题或上传此包。另外,您可以在Shopify的“感谢”页面添加自定义代码以添加跟踪器或“返回网站”按钮。文本字段“Additional scripts”位于您的Shopify后端admin.shopify.com/store/YOUR_SHOPIFY_ID/settings/checkout。它接受HTML、JS和liquid对象shop
和checkout
。
<a href="https://www.domain.com/" target="_blank" class="btn" style="margin-top:30px"> {% if shop.locale == "de" %} Zurück zum Shop {% else %} Return to shop {% endif %} </a>