mageworx/module-seobase-graph-ql

不适用

安装次数: 46,212

依赖关系: 0

建议者: 0

安全: 0

星标: 0

关注者: 4

分支: 1

开放问题: 1

类型:magento2-module

1.1.1 2021-09-22 16:09 UTC

This package is auto-updated.

Last update: 2024-09-22 22:51:52 UTC


README

为 Mageworx Magento 2 SEO Suite Ultimate 扩展提供的 GraphQL API 模块。

安装

1) 复制粘贴方法

  • 下载此模块并将其上传到 app/code/MageWorx/SeoBaseGraphQl 目录(如果不存在,请先创建“SeoBaseGraphQl”)

2) 使用 composer(从 packagist)安装

  • 执行以下命令: composer require mageworx/module-seobase-graph-ql

如何使用

SeoBaseGraphQL 模块扩展了产品、类别、CMS 页面查询的现有输出属性并包含

  • mw_canonical_url
    • url
    • code
  • meta_robots
  • mw_hreflangs
    • items
      • url
      • code

注意! 在规范 URL 的上下文中,代码表示 商店代码。在 hreflang URL 的上下文中,代码表示 hreflang 代码 - 例如 x-defaultenen_US 等。

其他属性根据指南定义: https://devdocs.magento.com/guides/v2.4/graphql/queries/products.html#productfilterinput-attributes

产品、类别、CMS 页面查询的语法类似于 Magento 用户指南。

例如,产品查询的语法如下

products(
  search: String
  filter: ProductAttributeFilterInput
  pageSize: Int
  currentPage: Int
  sort: ProductAttributeSortInput
): Products

请求

{
  products(filter: {sku: {eq: "24-WG02"}}) {
    total_count
    items {
      mw_canonical_url {
      	url
        code
      }
      meta_robots
      mw_hreflangs {
        items {
          url
          code
        }
      }
      name
      sku
        }
      }
    }

响应

{
  "data": {
    "products": {
      "items": [
        {
          "mw_canonical_url": {
            "url": "didi-sport-watch.html",
            "code": "store_code" 
          }          
          "meta_robots": null,
          "mw_hreflangs": {
            "items": [
              {
                "url": "didi-sport-watch.html",
                "code": "en"
              },
              {
                "url": "didi-sport-uhr.html",
                "code": "de"
              }
            ]
          },
          "name": "Didi Sport Watch",
          "sku": "24-WG02"
        }
      ]
    }
  }
}