yireo/magento2-byattribute-graph-ql

在 GraphQL 中显示任何产品属性的任何列表

安装: 372

依赖: 0

建议者: 0

安全: 0

星标: 3

关注者: 3

分支: 0

开放问题: 1

类型:magento2-module

0.1.1 2020-07-29 12:44 UTC

This package is auto-updated.

Last update: 2024-09-22 01:01:13 UTC


README

此 Magento 2 扩展添加了一个 GraphQL 端点,用于通过 GraphQL 访问产品属性。这至少需要 Magento 2.3 或更高版本。

要安装此模块,运行

composer require yireo/magento2-byattribute-graph-ql
./bin/magento module:enable Yireo_ByAttributeGraphQl

示例 GraphQL 查询

以下是一些示例 GraphQL 查询,用于展示此扩展的使用方法

{
  productAttribute(code:"material") {
    id
    code
    label
    default_value
    options {
      value
      label
      product_count
    }
  }
}

或者如果您想返回更少的信息(并包括类别过滤器)

{
  productAttribute(code:"color", category_id: 42) {
    id
    options {
      value
    }
  }
}

待办事项

  • 缓存产品计数的关键部分
  • 重构 ProductCounter 并将其拆分为更小的类