ecwhim/module-canonical-url-graph-ql

N/A

1.0.0 2022-10-24 20:51 UTC

This package is auto-updated.

Last update: 2024-09-25 01:32:17 UTC


README

此模块为Ecwhim的Magento 2 Canonical URL Extension提供对Magento GraphQL的支持。

安装

您可以通过以下方式安装模块

  1. 使用Composer通过packagist.com安装模块.
  2. 从github.com下载包.

使用Composer通过packagist.com安装模块

  1. 以文件系统所有者身份登录您的Magento服务器,或切换到文件系统所有者。
  2. 导航到您的Magento项目目录。
  3. 获取模块的最新版本
composer require ecwhim/module-canonical-url-graph-ql
  1. 启用模块.

从github.com下载包

  1. github下载最新版本的包。
  2. 将包解压缩到 <magento根目录>/app/code/Ecwhim/CanonicalUrlGraphQl 目录。
  3. 启用模块.

如何使用

CategoryInterface属性

以下表格定义了我们扩展添加的CategoryInterface属性。

示例用法

以下查询显示了如何获取类别的规范URL

请求

{
    categoryList(filters: {ids: {eq: "14"}}){
        id
        name
        ecw_canonical_url
    }
}

响应

{
    "data": {
        "categoryList": [
            {
                "id": 14,
                "name": "Jackets",
                "ecw_canonical_url": "https://example.com/men/tops-men/jackets-men.html"
            }
        ]
    }
}

CmsPage属性

以下表格定义了我们扩展添加的CmsPage属性。

示例用法

以下查询显示了如何获取CMS页面的规范URL

请求

{
    cmsPage(identifier: "customer-service") {
        identifier
        title
        ecw_canonical_url
    }
}

响应

{
    "data": {
        "cmsPage": {
            "identifier": "customer-service",
            "title": "Customer Service",
            "ecw_canonical_url": "https://example.com/customer-service"
        }
    }
}

ProductInterface属性

以下表格定义了我们扩展添加的ProductInterface属性。

示例用法

以下查询显示了如何获取产品的规范URL

请求

{
    products(filter: { sku: { eq: "24-MB01" } }) {
        items {
            name
            sku
            ecw_canonical_url
        }
    }
}

响应

{
    "data": {
        "products": {
            "items": [
                {
                    "name": "Joust Duffle Bag",
                    "sku": "24-MB01",
                    "ecw_canonical_url": "https://example.com/joust-duffle-bag.html"
                }
            ]
        }
    }
}