landofcoder/module-megamenu-graph-ql

Magento 2 大菜单 GraphQL 扩展

1.0.2 2022-07-26 08:16 UTC

This package is auto-updated.

Last update: 2024-09-26 12:58:30 UTC


README

``landofcoder/module-megamenu-graph-ql``

要求

主要功能

magento 2 大菜单 GraphQL 扩展

安装

* = 在生产环境中请使用 --keep-generated 选项

类型 1:压缩文件

  • 将压缩文件解压到 app/code/Lof
  • 通过运行 php bin/magento module:enable Lof_MegamenuGraphQl 启用模块
  • 通过运行 php bin/magento setup:upgrade 应用数据库更新*
  • 通过运行 php bin/magento cache:flush 清除缓存

类型 2:Composer

  • 将模块添加到 Composer 仓库,例如
    • 私有仓库 repo.magento.com
    • 公共仓库 packagist.org
    • 公共 GitHub 仓库作为 vcs
  • 通过运行 composer config repositories.repo.magento.com composer https://repo.magento.com/ 将 Composer 仓库添加到配置
  • 通过运行 composer require landofcoder/module-productlist-graph-ql 安装模块
  • 通过运行 php bin/magento module:enable Lof_MegamenuGraphQl 启用模块
  • 通过运行 php bin/magento setup:upgrade 应用数据库更新*
  • 通过运行 php bin/magento cache:flush 清除缓存

查询

  1. 通过菜单别名获取菜单配置

片段

fragment MenuNode on MegamenuItemNode {
    name
    show_name
    classes
    child_col
    sub_width
    align
    icon_position
    icon_classes
    is_group
    status
    disable_bellow
    show_icon
    icon
    show_header
    header_html
    show_left_sidebar
    left_sidebar_width
    menu_id
    left_sidebar_html
    show_content
    content_width
    content_type
    link_type
    link
    category
    target
    content_html
    show_right_sidebar
    right_sidebar_width
    right_sidebar_html
    show_footer
    footer_html
    color
    hover_color
    bg_color
    bg_hover_color
    inline_css
    tab_position
    before_html
    after_html
    caret
    hover_caret
    sub_height
    hover_icon
    dropdown_bgcolor
    dropdown_bgimage
    dropdown_bgimagerepeat
    dropdown_bgpositionx
    dropdown_bgpositiony
    dropdown_inlinecss
    parentcat
    animation_in
    animation_time
    child_col_type
    submenu_sorttype
    isgroup_level
}

查询(获取 3 级菜单项节点)针对菜单配置别名 top-menu

{
  megamenu (alias: "top-menu") {
    name
    alias
    disable_bellow
    event
    classes
    width
    disable_iblocks
    desktop_template
    scrolltofixed
    mobile_template
    nodes {
        ...MenuNode
        child_nodes {
            ...MenuNode
            child_nodes {
                ...MenuNode
            }
        }
    }
  }
}
  1. 获取可用的菜单配置列表

查询

{
    megamenus (
        filters: {}
        pageSize: 10
        currentPage: 1
    ) {
        items {
            name
            alias
        }
    }
}
  1. 获取商店配置

查询

storeConfig {
    megamenu_general_enabled
    megamenu_general_menu_alias
    megamenu_general_custom_css
}