swordfox / silverstripe-shopify
将Shopify产品导入您的Silverstripe网站,实现了购买按钮SDK以创建购物车和结账
Requires
- 1.4.0.6
- 1.4.0.5
- 1.4.0.4
- 1.4.0.3
- 1.4.0.2
- 1.4.0.1
- 1.4.0
- 1.3.9.3
- 1.3.9.2
- 1.3.9.1
- 1.3.9
- 1.3.8.0
- 1.3.7.2
- 1.3.7.1
- 1.3.7
- 1.3.6.5
- 1.3.6.4
- 1.3.6.3
- 1.3.6.2
- 1.3.6.1
- 1.3.6
- 1.3.5.1
- 1.3.5
- 1.3.4.1
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- dev-master / 1.2.x-dev
- 1.2.6.3
- 1.2.6.2
- 1.2.6.1
- 1.2.6
- 1.2.5.1
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-quicksuccession
This package is auto-updated.
Last update: 2024-09-09 03:52:14 UTC
README
本模块适用于希望将Shopify产品导入SilverStripe商店的用户。
基于xddesigners/silverstripe-shopify - 但已完全重构。
- 按产品分别添加/删除收藏夹。
- 导入任务具有选项:默认、仅产品 & 所有产品(见下文“设置导入脚本”)。
- 模板中包含购买按钮脚本,以便轻松修改和以您自己的方式实现。
- 移除了版本控制。
- 不会从Shopify导入图片,而是使用Images.weserv.nl - 一个图片缓存和缩放服务。
- 可选:从Shopify获取Webhooks以保持商店更新,无需依赖可能消耗资源的导入任务(见下文“设置Webhooks”)。
- 可选:对于希望在产品售出后在Shopify中删除产品的商店,delete_on_shopify很有用,适用于一次性产品的商店(见下文“设置delete_on_shopify”)。
使用Shopify Buy Button来创建购物车和结账界面。
您将获得一个导入任务,该任务获取所有产品变体并将它们存储在您的网站上的Product DataObject中。
要求
- SilverStripe 4.x
安装
通过Composer安装模块并配置API密钥。
composer require swordfox/silverstripe-shopify
在Shopify管理员界面中创建一个新的私有应用以获取API密钥。如果您想通过API使用Webhooks,例如dev/tasks/Swordfox-Shopify-Task-Webhooks/create,请确保'webhooks_shared_secret'与'shared_secret'相同,但如果您想使用手动添加的Webhooks,则需要从admin/settings/notifications
获取Webhooks共享密钥。
配置
Swordfox\Shopify\Client: api_key: 'YOUR_API_KEY' api_password: 'YOUR_API_PASSWORD' api_limit: 50 # Default limit, 250 max api_version: '2021-01' # Default 2021-01 storefront_access_token: 'YOUR_ACCESS_TOKEN' # for buybutton code shopify_domain: 'YOUR_SHOPIFY_DOMAIN' # mydomain.myshopify.com shared_secret: 'YOUR_API_SHARED_SECRET' webhooks_shared_secret: 'YOUR_WEBHOOKS_SHARED_SECRET' # Use same as above for webhooks added via API e.g. dev/tasks/Swordfox-Shopify-Task-Webhooks/create webhooks_create: 'products/update': 'shop/webhook/update/product' 'products/create': 'shop/webhook/update/product' 'products/delete': 'shop/webhook/delete/product' 'collections/create': 'shop/webhook/update/collection' 'collections/update': 'shop/webhook/update/collection' 'collections/delete': 'shop/webhook/delete/collection' 'inventory_levels/connect': 'shop/webhook/update/inventory' 'inventory_levels/update': 'shop/webhook/update/inventory' delete_on_shopify: false delete_on_shopify_after: '+3 days' # strtotime('+3 days') delete_on_shopify_keep_active: false hide_out_of_stock: false hide_if_no_image: false hide_if_collection_not_active: false new_based_on: 'Created' # LastEdited or ImageAdded (use with hide_if_no_image) new_timeframe: '+7 days' # strtotime('+7 days') cron_interval: '-18 hours' # Allow for timezone offset, e.g. if your timezone is +12:00, add your cron_interval to that as a negative value. So if your cron runs every 6 hours, set the cron_interval to '-18 hours' custom_metafields: true # product.metafields.custom.metatitle & product.metafields.custom.brand googlefeed_gtinbarcode: false # Show gtin as Barcode from Shopify googlefeed_mpnsku: true # Show mpn as SKU from Shopify googlefeed_condition: new # The condition of items # Override $default_sort Swordfox\Shopify\Model\Product: default_sort: 'Created DESC' # LastEdited DESC or ImageAdded DESC
设置导入脚本
您可以通过dev/tasks界面手动运行导入脚本,或将它们设置为cron任务。默认任务设计为每天运行一次,导入/更新最新的50个api_limit
从admin/products.json、admin/custom_collections.json和admin/smart_collections.json。http://example.com/dev/tasks/Swordfox-Shopify-Task-Import
或sake dev/tasks/Swordfox-Shopify-Task-Import
仅产品任务设计为在不使用Webhooks的情况下每天运行几次,导入最新的50个api_limit
从admin/products.json。
http://example.com/dev/tasks/Swordfox-Shopify-Task-Import/productsonly
或sake dev/tasks/Swordfox-Shopify-Task-Import/productsonly
所有产品任务设计为在初始设置时运行,并从admin/products.json、admin/custom_collections.json和admin/smart_collections.json导入所有内容。
http://example.com/dev/tasks/Swordfox-Shopify-Task-Import/productsall
或sake dev/tasks/Swordfox-Shopify-Task-Import/productsall
设置Webhooks
以下Webhooks受支持,并且可以通过API使用http://example.com/dev/tasks/Swordfox-Shopify-Task-Webhooks/create
或sake dev/tasks/Swordfox-Shopify-Task-Webhooks/create
自动创建。
- 创建收藏夹https://www.example.com/shop-page/webhook/update/collection
- 收藏删除 https://www.example.com/shop-page/webhook/delete/collection
- 收藏更新 https://www.example.com/shop-page/webhook/update/collection
- 库存水平连接 https://www.example.com/shop-page/webhook/update/inventory
- 库存水平更新 https://www.example.com/shop-page/webhook/update/inventory
- 产品创建 https://www.example.com/shop-page/webhook/update/product
- 产品删除 https://www.example.com/shop-page/webhook/delete/product
- 产品更新 https://www.example.com/shop-page/webhook/update/product
设置 delete_on_shopify
您可以通过 dev/tasks 接口手动运行 Shopify 上的删除脚本,或者设置成定时任务。此任务适用于销售一次性产品的商店,并在一定时间后将产品从 Shopify 上删除。例如,在导入任务中设置 ShopifyProduct::DeleteOnShopify 时,使用 delete_on_shopify_after: '+3 days'
,如果 delete_on_shopify: true
http://example.com/dev/tasks/Swordfox-Shopify-Task-DeleteOnShopify
或 sake dev/tasks/Swordfox-Shopify-Task-DeleteOnShopify