incapption/shopify2googleshopping
Composer 安装命令:
composer require incapption/shopify2googleshopping
包简介
Create a valid xml file for google shopping based on your shopify aritcles
README 文档
README
This is a package to quickly create a XML file for Google Shopping from Shopify products.
Installation
composer require incapption/shopify2googleshopping
How to use it
On the PHP side it looks something like this
<?php use Incapption\Shopify2GoogleShopping\Shopify2GoogleShopping; class SomeClass { public function doSomething() { $handler = new Shopify2GoogleShopping(); // set your shopify admin api credentials $handler->setShopifyCredentials( $_ENV['SHOPIFY_PRIVATE_API_KEY'], $_ENV['SHOPIFY_PRIVATE_API_PASSWORD'], $_ENV['SHOPIFY_PRIVATE_API_ACCESS_TOKEN'], "mydemoshop.myshopify.com" ); // optional: $handler->setTemplate('mypath/custom_template.liquid'); $handler->setProjectTitle('My Custom Shopify Shop'); $handler->setProjectDescription('This is a short description of my shop'); $handler->setProjectLink('https://myshop.shopify.com'); file_put_contents('mypath/product_feed.xml', $handler->generate()); } }
The template looks like this. You can either use the existing template or create your own. It has to be a liquid file.
<?xml version="1.0" encoding="UTF-8" ?> <rss version ="2.0" xmlns:g="http://base.google.com/ns/1.0" xmlns:c="http://base.google.com/cns/1.0"> <channel> <title>{{ project.title }}</title> <description>{{ project.description }}</description> <link>{{ project.link }}</link> {% for item in items %} <item> <g:title>{{ item.title }}</g:title> <g:condition>new</g:condition> <g:description>{{ item.body_html | strip_html | strip_newlines }}</g:description> <g:id>{{ item.id }}</g:id> <g:google_product_category>{{ item.metafield.custom.google_product_category }}</g:google_product_category> <g:image_link>{{ item.image.src }}</g:image_link> <g:link>{{ project.link }}/products/{{ item.handle }}</g:link> <g:price>{{ item.variants[0].price | decimals: 2, "en-US" | append: " EUR" }}</g:price> <g:availability>in stock</g:availability> <g:gtin>{{ item.metafield.custom.gtin }}</g:gtin> <g:brand>{{ item.metafield.custom.brand }}</g:brand> <g:g:product_type>{{ item.metafield.custom.product_type }}</g:g:product_type> <g:adult>no</g:adult> <g:shipping> <g:country>Germany</g:country> <g:service>Download</g:service> <g:price>{{ '0.00' | decimals: 2, "en-US" | append: " EUR" }}</g:price> </g:shipping> </item> {% endfor %} </channel> </rss>
Testing
You can test this package. For this you need your Shopify credentials. Make a copy named .env of the .env-example and enter your data.
./vendor/bin/phpunit tests
incapption/shopify2googleshopping 适用场景与选型建议
incapption/shopify2googleshopping 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 392 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 10 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 incapption/shopify2googleshopping 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 incapption/shopify2googleshopping 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 392
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-10-28