oxid-academy / graphql-product-extension
包的描述。
v1.0.0
2021-10-01 12:54 UTC
Requires
- php: ^7.4
- oxid-esales/graphql-storefront: ^1.0
This package is auto-updated.
Last update: 2024-09-06 18:42:29 UTC
README
本模块通过添加两个新字段 itemNumber 和 subtitle 扩展了 Storefront 产品对象。
itemNumber
该字段是对 oxarticles__oxartnum 字段的包装,并显示基本功能。
subtitle
代表 oxarticles_oxartnum 表的定制字段。为了简化,我们取了一个现有字段并更改了其值。
安装
composer require oxid-academy/graphql-product-extension vendor/bin/oe-console oe:module:activate oe_graphql_storefront vendor/bin/oe-console oe:module:activate oxac_graphql_productextension
[ ! ] 模块 oxid-academy/graphql-product 必须被禁用
vendor/bin/oe-console oe:module:deactivate oxac_graphql_product
用法
您可以使用您喜欢的 GraphQL 客户端来探索 API,如果您还没有安装,您可以使用 Altair GraphQL 客户端。
查询
URL: https:///graphql/?shp=1&lang=0
请求
query {
product (productId: "05848170643ab0deb9914566391c0c63") {
itemNumber,
subtitle
}
}
响应
{
"data": {
"product": {
"itemNumber": "1402",
"subtitle": "sadsadasd <-> dsadasdas"
}
}
}
来源
- 关于模块架构和 GraphQL 模块的知识背景,因为它与 eShop 框架不同。
https://madewithlove.com/blog/software-engineering/hexagonal-architecture-demystified/ - GraphQL 模块文档包含一个教程,描述了如何编写自己的查询和突变。基于此文档,编写了此示例模块。
https://docs.oxid-esales.com/interfaces/graphql/en/latest/tutorials/introduction.html