mageworx/module-optiongraphql

APO 的 GraphQL 支持

安装量: 19,360

依赖项: 0

建议者: 0

安全: 0

星标: 2

关注者: 4

分支: 4

开放问题: 1

类型:magento2-module

2.2.0 2023-12-19 20:04 UTC

README

本 GraphQL 模块是 Magento 2 的高级产品选项套件模块的附加组件。它增加了对 GraphQL API 的支持,以便在 PWA 店面上使用 APO 扩展提供的功能。

我们的模块扩展了原始的 Magento 产品 GraphQL 请求,以添加我们的属性。如果您配置中不需要这些属性,您可以手动删除它们。

产品请求
{
  products(filter: {sku: {eq: "testMW"}}) {
    items {
      id
      name
      sku
      __typename
      dependency_rules
      hidden_dependents
      absolute_price
      absolute_cost
      absolute_weight
      sku_policy
      shareable_link
      hide_additional_product_price
      ... on CustomizableProductInterface {
        options {
          __typename
          title
          required
          sort_order
          option_id
          qty_input
          div_class
          one_time
          is_swatch
          is_hidden
          mageworx_option_gallery
          mageworx_option_image_mode
          description
          sku_policy
          is_all_customer_groups
          is_all_store_views
          customer_group
          store_view
          disabled
          disabled_by_values
          selection_limit_from
          selection_limit_to
          ... on CustomizableDropDownOption {
            dropdown_value: value {
              title
              option_type_id
              price
              price_type
              sku
              mageworx_option_type_price
              mageworx_title
              special_price
              tier_price
              description
              dependency
              dependency_type
              cost
              images_data
              is_default
              qty_multiplier
              weight
              weight_type
              qty
              manage_stock
              disabled
            }
          }
          ... on CustomizableRadioOption {
                radio_value: value {
              title
              option_type_id
              price
              price_type
              sku
              mageworx_option_type_price
              mageworx_title
              special_price
              tier_price
              description
              dependency
              dependency_type
              cost
              images_data
              is_default
              qty_multiplier
              weight
              weight_type
              qty
              manage_stock
              disabled
            }
          }
          ... on CustomizableMultipleOption {
            multiple_value: value {
              title
              option_type_id
              price
              price_type
              sku
              mageworx_option_type_price
              mageworx_title
              special_price
              tier_price
              description
              dependency
              dependency_type
              cost
              images_data
              is_default
              qty_multiplier
              weight
              weight_type
              qty
              manage_stock
              disabled
            }
          }
          ... on CustomizableCheckboxOption {
            checkbox_value: value {
              title
              option_type_id
              price
              price_type
              sku
              mageworx_option_type_price
              mageworx_title
              special_price
              tier_price
              description
              dependency
              dependency_type
              cost
              images_data
              is_default
              qty_multiplier
              weight
              weight_type
              qty
              manage_stock
              disabled
            }
          }
          ... on CustomizableFieldOption {
            field_value: value {
              max_characters
              price_type
              price
              sku
              mageworx_option_price
              mageworx_title
              dependency
              dependency_type
            }
          }
          ... on CustomizableAreaOption {
            area_value: value {
              max_characters
              price_type
              price
              sku
              mageworx_option_price
              mageworx_title
              dependency
              dependency_type
            }
          }
          ... on CustomizableFileOption {
            file_value: value {
              file_extension
              image_size_x
              image_size_y
              price_type
              price
              sku
              mageworx_option_price
              mageworx_title
              dependency
              dependency_type
            }
          }
          ... on CustomizableDateOption {
            date_value: value {
              price_type
              price
              sku
              mageworx_option_price
              mageworx_title
              dependency
              dependency_type
            }
          }
        }
      }
    }
  }
}
产品响应
{
  "data": {
    "products": {
      "items": [
        {
          "id": 24,
          "name": "testMW",
          "sku": "testMW",
          "__typename": "SimpleProduct",
          "dependency_rules": "[{\"conditions\":[{\"values\":[],\"type\":\"!eq\",\"id\":172}],\"condition_type\":\"or\",\"actions\":{\"hide\":{\"174\":{\"values\":[],\"id\":174},\"175\":{\"values\":[],\"id\":175}}}},{\"conditions\":[{\"values\":[\"1094\"],\"type\":\"!eq\",\"id\":172}],\"condition_type\":\"or\",\"actions\":{\"hide\":{\"174\":{\"values\":{\"1098\":\"1098\",\"1099\":\"1099\",\"1100\":\"1100\",\"1101\":\"1101\"},\"id\":174}}}},{\"conditions\":[{\"values\":[\"1092\",\"1093\",\"1094\"],\"type\":\"!eq\",\"id\":172}],\"condition_type\":\"and\",\"actions\":{\"hide\":{\"175\":{\"values\":[],\"id\":175}}}},{\"conditions\":[{\"values\":[],\"type\":\"!eq\",\"id\":171}],\"condition_type\":\"or\",\"actions\":{\"hide\":{\"176\":{\"values\":[],\"id\":176}}}},{\"conditions\":[{\"values\":[\"1090\",\"1091\"],\"type\":\"!eq\",\"id\":171}],\"condition_type\":\"and\",\"actions\":{\"hide\":{\"176\":{\"values\":[],\"id\":176}}}},{\"conditions\":[{\"values\":[],\"type\":\"!eq\",\"id\":170}],\"condition_type\":\"or\",\"actions\":{\"hide\":{\"177\":{\"values\":[],\"id\":177}}}},{\"conditions\":[{\"values\":[\"1087\",\"1088\",\"1089\"],\"type\":\"!eq\",\"id\":170}],\"condition_type\":\"and\",\"actions\":{\"hide\":{\"177\":{\"values\":[],\"id\":177}}}}]",
          "hidden_dependents": "{\"hidden_options\":[176,177],\"hidden_values\":[],\"preselected_values\":{\"172\":[1092,1093,1094],\"174\":[1100]}}",
          "absolute_price": "1",
          "absolute_cost": "0",
          "absolute_weight": "1",
          "sku_policy": "use_config",
          "shareable_link": null,
          "hide_additional_product_price": "0",
          "options": [
            {
              "__typename": "CustomizableDropDownOption",
              "title": "drop-down",
              "required": true,
              "sort_order": 1,
              "option_id": 170,
              "qty_input": "0",
              "div_class": "",
              "one_time": "0",
              "is_swatch": "0",
              "is_hidden": "0",
              "mageworx_option_gallery": "0",
              "mageworx_option_image_mode": "0",
              "description": "[{\"store_id\":\"0\",\"description\":\"option description\"}]",
              "sku_policy": "independent",
              "is_all_customer_groups": null,
              "is_all_store_views": null,
              "customer_group": null,
              "store_view": null,
              "disabled": "0",
              "disabled_by_values": "0",
              "selection_limit_from": "0",
              "selection_limit_to": "0",
              "dropdown_value": [
                {
                  "title": "1",
                  "option_type_id": 1087,
                  "price": 1,
                  "price_type": "FIXED",
                  "sku": "d1",
                  "mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"1.000000\"}]",
                  "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"1\"}]",
                  "special_price": null,
                  "tier_price": null,
                  "description": "[{\"store_id\":\"0\",\"description\":\"value description\"}]",
                  "dependency": null,
                  "dependency_type": "0",
                  "cost": "0.000000",
                  "images_data": "[{\"value\":\"/8/a/8a288a.jpg\",\"option_type_image_id\":\"667\",\"title_text\":\"\",\"sort_order\":\"1\",\"base_image\":\"1\",\"replace_main_gallery_image\":\"1\",\"custom_media_type\":\"color\",\"color\":\"8a288a\",\"disabled\":\"0\",\"overlay_image\":\"0\",\"tooltip_image\":\"1\"}]",
                  "is_default": "0",
                  "qty_multiplier": "0",
                  "weight": "0.000000",
                  "weight_type": "fixed",
                  "qty": "111.0000",
                  "manage_stock": "1",
                  "disabled": "0"
                },
                {
                  "title": "2",
                  "option_type_id": 1088,
                  "price": 110,
                  "price_type": "FIXED",
                  "sku": "d2",
                  "mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"110.000000\"}]",
                  "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"2\"}]",
                  "special_price": "[{\"price\":\"90.0000\",\"customer_group_id\":\"32000\",\"price_type\":\"fixed\",\"date_from\":\"\",\"date_to\":\"\",\"comment\":\"\"}]",
                  "tier_price": null,
                  "description": "[{\"store_id\":\"0\",\"description\":\"value description\"}]",
                  "dependency": null,
                  "dependency_type": "0",
                  "cost": "0.000000",
                  "images_data": null,
                  "is_default": "0",
                  "qty_multiplier": "0",
                  "weight": "0.000000",
                  "weight_type": "fixed",
                  "qty": "222.0000",
                  "manage_stock": "1",
                  "disabled": "0"
                },
                {
                  "title": "3",
                  "option_type_id": 1089,
                  "price": 123,
                  "price_type": "FIXED",
                  "sku": "simple",
                  "mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"123.000000\"}]",
                  "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"3\"}]",
                  "special_price": null,
                  "tier_price": "[{\"price\":\"100.0000\",\"customer_group_id\":\"32000\",\"price_type\":\"fixed\",\"date_from\":\"\",\"date_to\":\"\",\"qty\":\"3\"},{\"price\":\"90.0000\",\"customer_group_id\":\"32000\",\"price_type\":\"fixed\",\"date_from\":\"\",\"date_to\":\"\",\"qty\":\"4\"},{\"price\":\"80.0000\",\"customer_group_id\":\"32000\",\"price_type\":\"fixed\",\"date_from\":\"\",\"date_to\":\"\",\"qty\":\"5\"}]",
                  "description": "[{\"store_id\":\"0\",\"description\":\"value description\"}]",
                  "dependency": null,
                  "dependency_type": "0",
                  "cost": null,
                  "images_data": null,
                  "is_default": "0",
                  "qty_multiplier": "0",
                  "weight": null,
                  "weight_type": "fixed",
                  "qty": "121.0000",
                  "manage_stock": "1",
                  "disabled": "0"
                }
              ]
            },
            {
              "__typename": "CustomizableRadioOption",
              "title": "radio",
              "required": true,
              "sort_order": 2,
              "option_id": 171,
              "qty_input": "0",
              "div_class": "test div class",
              "one_time": "1",
              "is_swatch": "0",
              "is_hidden": "0",
              "mageworx_option_gallery": "1",
              "mageworx_option_image_mode": "1",
              "description": "[{\"store_id\":\"0\",\"description\":\"option description\"}]",
              "sku_policy": "use_config",
              "is_all_customer_groups": null,
              "is_all_store_views": null,
              "customer_group": null,
              "store_view": null,
              "disabled": "0",
              "disabled_by_values": "0",
              "selection_limit_from": "1",
              "selection_limit_to": "2",
              "radio_value": [
                {
                  "title": "r1",
                  "option_type_id": 1090,
                  "price": 22,
                  "price_type": "FIXED",
                  "sku": "",
                  "mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"22.000000\"}]",
                  "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"r1\"}]",
                  "special_price": null,
                  "tier_price": null,
                  "description": "[{\"store_id\":\"0\",\"description\":\"value description\"}]",
                  "dependency": null,
                  "dependency_type": "0",
                  "cost": "0.000000",
                  "images_data": "[{\"value\":\"/0/0/0034e0.jpg\",\"option_type_image_id\":\"668\",\"title_text\":\"\",\"sort_order\":\"1\",\"base_image\":\"1\",\"replace_main_gallery_image\":\"1\",\"custom_media_type\":\"color\",\"color\":\"0034e0\",\"disabled\":\"0\",\"overlay_image\":\"0\",\"tooltip_image\":\"1\"}]",
                  "is_default": "0",
                  "qty_multiplier": "0",
                  "weight": "0.000000",
                  "weight_type": "fixed",
                  "qty": "0.0000",
                  "manage_stock": "0",
                  "disabled": "0"
                },
                {
                  "title": "r2",
                  "option_type_id": 1091,
                  "price": 11,
                  "price_type": "FIXED",
                  "sku": "",
                  "mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"11.000000\"}]",
                  "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"r2\"}]",
                  "special_price": null,
                  "tier_price": null,
                  "description": "[{\"store_id\":\"0\",\"description\":\"value description\"}]",
                  "dependency": null,
                  "dependency_type": "0",
                  "cost": "0.000000",
                  "images_data": "[{\"value\":\"/b/f/bf64bf.jpg\",\"option_type_image_id\":\"669\",\"title_text\":\"\",\"sort_order\":\"1\",\"base_image\":\"1\",\"replace_main_gallery_image\":\"1\",\"custom_media_type\":\"color\",\"color\":\"bf64bf\",\"disabled\":\"0\",\"overlay_image\":\"0\",\"tooltip_image\":\"1\"}]",
                  "is_default": "0",
                  "qty_multiplier": "0",
                  "weight": "0.000000",
                  "weight_type": "fixed",
                  "qty": "0.0000",
                  "manage_stock": "0",
                  "disabled": "0"
                }
              ]
            },
            {
              "__typename": "CustomizableCheckboxOption",
              "title": "checkbox",
              "required": true,
              "sort_order": 3,
              "option_id": 172,
              "qty_input": "0",
              "div_class": "",
              "one_time": "0",
              "is_swatch": "0",
              "is_hidden": "1",
              "mageworx_option_gallery": "0",
              "mageworx_option_image_mode": "0",
              "description": "[{\"store_id\":\"0\",\"description\":\"option description\"}]",
              "sku_policy": "use_config",
              "is_all_customer_groups": null,
              "is_all_store_views": null,
              "customer_group": null,
              "store_view": null,
              "disabled": "0",
              "disabled_by_values": "0",
              "selection_limit_from": "0",
              "selection_limit_to": "0",
              "checkbox_value": [
                {
                  "title": "c1",
                  "option_type_id": 1092,
                  "price": 1,
                  "price_type": "FIXED",
                  "sku": "",
                  "mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"1.000000\"}]",
                  "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"c1\"}]",
                  "special_price": null,
                  "tier_price": null,
                  "description": "[{\"store_id\":\"0\",\"description\":\"value description\"}]",
                  "dependency": null,
                  "dependency_type": "0",
                  "cost": "0.000000",
                  "images_data": null,
                  "is_default": "1",
                  "qty_multiplier": "0",
                  "weight": "0.000000",
                  "weight_type": "fixed",
                  "qty": "0.0000",
                  "manage_stock": "0",
                  "disabled": "0"
                },
                {
                  "title": "c2",
                  "option_type_id": 1093,
                  "price": 2,
                  "price_type": "FIXED",
                  "sku": "",
                  "mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"2.000000\"}]",
                  "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"c2\"}]",
                  "special_price": null,
                  "tier_price": null,
                  "description": "[{\"store_id\":\"0\",\"description\":\"value description\"}]",
                  "dependency": null,
                  "dependency_type": "0",
                  "cost": "0.000000",
                  "images_data": null,
                  "is_default": "1",
                  "qty_multiplier": "0",
                  "weight": "0.000000",
                  "weight_type": "fixed",
                  "qty": "0.0000",
                  "manage_stock": "0",
                  "disabled": "0"
                },
                {
                  "title": "c3",
                  "option_type_id": 1094,
                  "price": 3,
                  "price_type": "FIXED",
                  "sku": "",
                  "mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"3.000000\"}]",
                  "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"c3\"}]",
                  "special_price": null,
                  "tier_price": null,
                  "description": "[{\"store_id\":\"0\",\"description\":\"value description\"}]",
                  "dependency": null,
                  "dependency_type": "0",
                  "cost": "0.000000",
                  "images_data": null,
                  "is_default": "1",
                  "qty_multiplier": "0",
                  "weight": "0.000000",
                  "weight_type": "fixed",
                  "qty": "0.0000",
                  "manage_stock": "0",
                  "disabled": "0"
                }
              ]
            },
            {
              "__typename": "CustomizableMultipleOption",
              "title": "multi-select",
              "required": true,
              "sort_order": 4,
              "option_id": 173,
              "qty_input": "0",
              "div_class": "value description",
              "one_time": "0",
              "is_swatch": "0",
              "is_hidden": "0",
              "mageworx_option_gallery": "0",
              "mageworx_option_image_mode": "0",
              "description": "[{\"store_id\":\"0\",\"description\":\"option description\"}]",
              "sku_policy": "use_config",
              "is_all_customer_groups": null,
              "is_all_store_views": null,
              "customer_group": null,
              "store_view": null,
              "disabled": "0",
              "disabled_by_values": "0",
              "selection_limit_from": "1",
              "selection_limit_to": "2",
              "multiple_value": [
                {
                  "title": "m1",
                  "option_type_id": 1095,
                  "price": 0,
                  "price_type": "FIXED",
                  "sku": "",
                  "mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"0.000000\"}]",
                  "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"m1\"}]",
                  "special_price": null,
                  "tier_price": null,
                  "description": "[{\"store_id\":\"0\",\"description\":\"value description\"}]",
                  "dependency": null,
                  "dependency_type": "0",
                  "cost": "0.000000",
                  "images_data": null,
                  "is_default": "0",
                  "qty_multiplier": "0",
                  "weight": "0.000000",
                  "weight_type": "fixed",
                  "qty": "0.0000",
                  "manage_stock": "0",
                  "disabled": "0"
                },
                {
                  "title": "m2",
                  "option_type_id": 1096,
                  "price": 0,
                  "price_type": "FIXED",
                  "sku": "",
                  "mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"0.000000\"}]",
                  "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"m2\"}]",
                  "special_price": null,
                  "tier_price": null,
                  "description": "[{\"store_id\":\"0\",\"description\":\"value description\"}]",
                  "dependency": null,
                  "dependency_type": "0",
                  "cost": "0.000000",
                  "images_data": null,
                  "is_default": "0",
                  "qty_multiplier": "0",
                  "weight": "0.000000",
                  "weight_type": "fixed",
                  "qty": "0.0000",
                  "manage_stock": "0",
                  "disabled": "0"
                },
                {
                  "title": "m3",
                  "option_type_id": 1097,
                  "price": 0,
                  "price_type": "FIXED",
                  "sku": "",
                  "mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"0.000000\"}]",
                  "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"m3\"}]",
                  "special_price": null,
                  "tier_price": null,
                  "description": "[{\"store_id\":\"0\",\"description\":\"value description\"}]",
                  "dependency": null,
                  "dependency_type": "0",
                  "cost": "0.000000",
                  "images_data": null,
                  "is_default": "0",
                  "qty_multiplier": "0",
                  "weight": "0.000000",
                  "weight_type": "fixed",
                  "qty": "0.0000",
                  "manage_stock": "0",
                  "disabled": "0"
                }
              ]
            },
            {
              "__typename": "CustomizableDropDownOption",
              "title": "drop-down swatch",
              "required": true,
              "sort_order": 5,
              "option_id": 174,
              "qty_input": "0",
              "div_class": "value description",
              "one_time": "0",
              "is_swatch": "1",
              "is_hidden": "0",
              "mageworx_option_gallery": "0",
              "mageworx_option_image_mode": "0",
              "description": "[{\"store_id\":\"0\",\"description\":\"option description\"}]",
              "sku_policy": "use_config",
              "is_all_customer_groups": null,
              "is_all_store_views": null,
              "customer_group": null,
              "store_view": null,
              "disabled": "0",
              "disabled_by_values": "0",
              "selection_limit_from": "0",
              "selection_limit_to": "0",
              "dropdown_value": [
                {
                  "title": "s1",
                  "option_type_id": 1098,
                  "price": 0,
                  "price_type": "FIXED",
                  "sku": "",
                  "mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"0.000000\"}]",
                  "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"s1\"}]",
                  "special_price": null,
                  "tier_price": null,
                  "description": "[{\"store_id\":\"0\",\"description\":\"value description\"}]",
                  "dependency": "[[\"172\",\"1094\"]]",
                  "dependency_type": "0",
                  "cost": "3.000000",
                  "images_data": null,
                  "is_default": "0",
                  "qty_multiplier": "0",
                  "weight": "3333.000000",
                  "weight_type": "fixed",
                  "qty": "0.0000",
                  "manage_stock": "0",
                  "disabled": "0"
                },
                {
                  "title": "s2",
                  "option_type_id": 1099,
                  "price": 0,
                  "price_type": "FIXED",
                  "sku": "",
                  "mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"0.000000\"}]",
                  "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"s2\"}]",
                  "special_price": null,
                  "tier_price": null,
                  "description": "[{\"store_id\":\"0\",\"description\":\"value description\"}]",
                  "dependency": "[[\"172\",\"1094\"]]",
                  "dependency_type": "0",
                  "cost": "22.000000",
                  "images_data": null,
                  "is_default": "0",
                  "qty_multiplier": "0",
                  "weight": "333.000000",
                  "weight_type": "fixed",
                  "qty": "0.0000",
                  "manage_stock": "0",
                  "disabled": "0"
                },
                {
                  "title": "s3",
                  "option_type_id": 1100,
                  "price": 0,
                  "price_type": "FIXED",
                  "sku": "",
                  "mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"0.000000\"}]",
                  "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"s3\"}]",
                  "special_price": null,
                  "tier_price": null,
                  "description": "[{\"store_id\":\"0\",\"description\":\"value description\"}]",
                  "dependency": "[[\"172\",\"1094\"]]",
                  "dependency_type": "0",
                  "cost": "123.000000",
                  "images_data": null,
                  "is_default": "1",
                  "qty_multiplier": "0",
                  "weight": "222.000000",
                  "weight_type": "fixed",
                  "qty": "0.0000",
                  "manage_stock": "0",
                  "disabled": "0"
                },
                {
                  "title": "s4",
                  "option_type_id": 1101,
                  "price": 0,
                  "price_type": "FIXED",
                  "sku": "",
                  "mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"0.000000\"}]",
                  "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"s4\"}]",
                  "special_price": null,
                  "tier_price": null,
                  "description": "[{\"store_id\":\"0\",\"description\":\"value description\"}]",
                  "dependency": "[[\"172\",\"1094\"]]",
                  "dependency_type": "0",
                  "cost": "123.000000",
                  "images_data": null,
                  "is_default": "0",
                  "qty_multiplier": "0",
                  "weight": "222.000000",
                  "weight_type": "fixed",
                  "qty": "0.0000",
                  "manage_stock": "0",
                  "disabled": "1"
                }
              ]
            },
            {
              "__typename": "CustomizableAreaOption",
              "title": "area default",
              "required": true,
              "sort_order": 6,
              "option_id": 175,
              "qty_input": "0",
              "div_class": "test div class",
              "one_time": "0",
              "is_swatch": "0",
              "is_hidden": "0",
              "mageworx_option_gallery": "0",
              "mageworx_option_image_mode": "0",
              "description": "[{\"store_id\":\"0\",\"description\":\"option description\"}]",
              "sku_policy": "use_config",
              "is_all_customer_groups": null,
              "is_all_store_views": null,
              "customer_group": null,
              "store_view": null,
              "disabled": "0",
              "disabled_by_values": "0",
              "selection_limit_from": "0",
              "selection_limit_to": "0",
              "area_value": {
                "max_characters": 0,
                "price_type": "FIXED",
                "price": 100,
                "sku": "",
                "mageworx_option_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"100.000000\"}]",
                "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"area\"},{\"store_id\":\"1\",\"title\":\"area default\"},{\"store_id\":\"2\",\"title\":\"area en_GB\"}]",
                "dependency": "[[\"172\",\"1092\"],[\"172\",\"1093\"],[\"172\",\"1094\"]]",
                "dependency_type": "0"
              }
            },
            {
              "__typename": "CustomizableFieldOption",
              "title": "field deafult",
              "required": true,
              "sort_order": 7,
              "option_id": 176,
              "qty_input": "0",
              "div_class": "test div class",
              "one_time": "0",
              "is_swatch": "0",
              "is_hidden": "0",
              "mageworx_option_gallery": "0",
              "mageworx_option_image_mode": "0",
              "description": "[{\"store_id\":\"0\",\"description\":\"option description\"}]",
              "sku_policy": "use_config",
              "is_all_customer_groups": null,
              "is_all_store_views": null,
              "customer_group": null,
              "store_view": null,
              "disabled": "0",
              "disabled_by_values": "0",
              "selection_limit_from": "0",
              "selection_limit_to": "0",
              "field_value": {
                "max_characters": 0,
                "price_type": "FIXED",
                "price": 200,
                "sku": "",
                "mageworx_option_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"200.000000\"}]",
                "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"field\"},{\"store_id\":\"1\",\"title\":\"field deafult\"},{\"store_id\":\"2\",\"title\":\"field en_GB \"}]",
                "dependency": "[[\"171\",\"1090\"],[\"171\",\"1091\"]]",
                "dependency_type": "0"
              }
            },
            {
              "__typename": "CustomizableDateOption",
              "title": "date",
              "required": true,
              "sort_order": 8,
              "option_id": 177,
              "qty_input": "0",
              "div_class": "test div class",
              "one_time": "0",
              "is_swatch": "0",
              "is_hidden": "0",
              "mageworx_option_gallery": "0",
              "mageworx_option_image_mode": "0",
              "description": "[{\"store_id\":\"0\",\"description\":\"option description\"}]",
              "sku_policy": "use_config",
              "is_all_customer_groups": null,
              "is_all_store_views": null,
              "customer_group": null,
              "store_view": null,
              "disabled": "0",
              "disabled_by_values": "0",
              "selection_limit_from": "0",
              "selection_limit_to": "0",
              "date_value": {
                "price_type": "FIXED",
                "price": 300,
                "sku": "",
                "mageworx_option_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"300.000000\"}]",
                "mageworx_title": "[{\"store_id\":\"0\",\"title\":\"date\"}]",
                "dependency": "[[\"170\",\"1087\"],[\"170\",\"1088\"],[\"170\",\"1089\"]]",
                "dependency_type": "0"
              }
            }
          ]
        }
      ]
    }
  }
}

请参阅以下额外的 GraphQL 请求

依赖状态

计算依赖关系和默认状态。当客户选择某些选项时,它返回应隐藏和/或作为默认值选择的值。

依赖状态请求
{
    dependencyState (
        productSku: "testMW"
        selectedValues: "2419,2420"
    ) {
        hidden_options
        hidden_values
        preselected_values
    }
}
依赖状态响应
{
  "data": {
    "dependencyState": {
      "hidden_options": [
        174,
        175,
        176,
        177
      ],
      "hidden_values": [
        1098,
        1099,
        1100,
        1101
      ],
      "preselected_values": "{\"73\":[2419]}"
    }
  }
}
依赖状态错误响应
{
  "errors": [
    {
      "message": "Selected value '2420' is wrong and should be hidden",
      "extensions": {
        "category": "graphql-input"
      },
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "dependencyState"
      ]
    }
  ],
  "data": {
    "dependencyState": null
  }
}

注意:如果您使用依赖项选项,应使用“依赖状态”请求。每次客户在前端选择一个选项的值时,您都应该发送“依赖状态”请求以获取应隐藏或预选的值的列表。您应在此请求中保留所有选定的值。例如,您应添加新的选定值,同时保留此请求中的先前值,以便扩展能够正确地计算依赖关系。

“DependencyState”响应包含以下键的对象

  • hidden_options - 应隐藏的选项 ID 的数组。
  • hidden_values - 应隐藏的值 ID 的数组。
  • preselected_values - 包含具有结构 "key - 数组与值" 的 JSON 行,其中 "key" 是选项 ID,"数组与值" - 值 ID。

"preselected_values" 复制请求中发送的值,并添加应显示且可能被预选的值。

如果您出于某些原因不想使用此方法来计算依赖关系和默认状态,我们已将“dependency_rules”字段添加到产品请求和响应中(有关更多详细信息,请参阅上述产品请求和响应)。

否则,我们建议从产品请求中删除“dependency_rules”字段以提高性能。

"dependency_rules" 是包含规则的 JSON 行,每个规则都是具有以下结构的数组

  • conditions - 它是条件的数组。每个条件中可能的键:{"values":["2418"],"type":"!eq","id":73},其中
    --- "id" - 选项 ID,
    --- "values" - 值 ID,
    --- "type" - 可能的值 "eq" 和 "!eq",分别表示 "等于" 和 "不等于"。
    在此示例中,如果选项 "73" 的值 ID 为 "2418" 未选中,则条件将有效。

  • condition_type - 它是用于组合条件的逻辑运算符。可能的值:"OR","AND"。

  • actions - 如果条件满足,则应执行的操作。示例:{"hide":{"74":{"values":{"2420":2420},"id":74}}}。当前可用的操作仅为 "hide"。此示例隐藏了选项 "74" 的 ID 为 "2420" 的值。

注意:这些值仅存在于“可选项”中。对于“字段”等选项类型,"values"将是空的。

“hidden_dependents”行结构与“DependencyState” (如上所述)相同。

高级产品选项设置

此查询包含所有高级产品选项配置设置,您可以在管理店铺的“配置”->“Mageworx”->“高级产品选项”选项卡中看到这些设置

高级产品选项设置请求
{
  advancedProductOptionsSettings {
      product_price_display_mode
      is_enabled_additional_product_price_field
      additional_product_price_field_label
      additional_product_price_field_mode
      is_qty_input_enabled
      default_qty_label
      is_option_value_description_enabled
      is_option_description_enabled
      get_option_description_mode
      selection_limit_template_data
      base_image_thumbnail_height
      base_image_thumbnail_width
      tooltip_image_thumbnail_size
      is_enabled_shareable_link
      shareable_link_text
      shareable_link_hint_text
      shareable_link_success_text
      is_load_linked_product_enabled
      is_enabled_fide_value_price
      is_enabled_hide_product_page_value_price
      is_enabled_customize_and_add_to_cart_button
      is_show_swatch_title
      is_show_swatch_price
      swatch_width
      swatch_height
      text_swatch_max_width
      is_enabled_option_inventory
      is_display_option_inventory_on_frontend
      is_display_out_of_stock_message
      is_display_out_of_stock_message_on_options_level
      is_display_out_of_stock_options
      is_require_hidden_out_of_stock_options
      is_special_price_enabled
      is_tier_price_enabled
      is_display_tier_price_table_needed
  }
}
高级产品选项设置响应
{
  "data": {
    "advancedProductOptionsSettings": {
      "product_price_display_mode": "disabled",
      "is_enabled_additional_product_price_field": false,
      "additional_product_price_field_label": "Total Price:",
      "additional_product_price_field_mode": "final_price",
      "is_qty_input_enabled": false,
      "default_qty_label": "Qty: ",
      "is_option_value_description_enabled": true,
      "is_option_description_enabled": true,
      "get_option_description_mode": 1,
      "selection_limit_template_data": "{\"selection_limit_from_message\":\"Please choose {selection_limit_from} values at least\",\"selection_limit_to_message\":\"Please choose {selection_limit_to} values max\",\"selection_limit_from_to_message\":\"Please choose from {selection_limit_from} to {selection_limit_to} values\"}",
      "base_image_thumbnail_height": 35,
      "base_image_thumbnail_width": 0,
      "tooltip_image_thumbnail_size": 130,
      "is_enabled_shareable_link": false,
      "shareable_link_text": "Get shareable link",
      "shareable_link_hint_text": "Get the link to the product with selected options",
      "shareable_link_success_text": "Link copied to clipboard",
      "is_load_linked_product_enabled": false,
      "is_enabled_fide_value_price": false,
      "is_enabled_hide_product_page_value_price": false,
      "is_enabled_customize_and_add_to_cart_button": false,
      "is_show_swatch_title": false,
      "is_show_swatch_price": false,
      "swatch_width": 35,
      "swatch_height": 35,
      "text_swatch_max_width": "90",
      "is_enabled_option_inventory": true,
      "is_display_option_inventory_on_frontend": true,
      "is_display_out_of_stock_message": true,
      "is_display_out_of_stock_message_on_options_level": false,
      "is_display_out_of_stock_options": true,
      "is_require_hidden_out_of_stock_options": true,
      "is_special_price_enabled": true,
      "is_tier_price_enabled": true,
      "is_display_tier_price_table_needed": false
    }
  }
}

“AdvancedProductOptionsSettings”响应包含以下键的params

  • product_price_display_mode - 包含“产品价格显示模式”参数的字符串
  • is_enabled_additional_product_price_field - 包含“启用附加产品价格字段”参数的布尔值
  • additional_product_price_field_label - 包含“附加产品价格字段标签”参数的字符串
  • additional_product_price_field_mode - 包含“附加产品价格字段模式”参数的字符串
  • is_qty_input_enabled - 包含“启用数量输入功能”参数的布尔值
  • default_qty_label - 包含“数量标签”参数的字符串
  • is_option_value_description_enabled - 包含“启用选项值描述”参数的布尔值
  • is_option_description_enabled - 包含“启用选项描述”参数的布尔值
  • get_option_description_mode - 包含“获取选项描述模式。0 - 否,1 - 工具提示,2 - 选项旁边的纯文本”参数的整数
  • selection_limit_template_data - 包含选择限制模板数据的JSON
  • base_image_thumbnail_height - 包含“基础图片高度”参数的整数
  • base_image_thumbnail_width - 包含“基础图片宽度”参数的整数
  • tooltip_image_thumbnail_size - 整数 @doc(描述:"工具提示图片大小"参数)
  • is_enabled_shareable_link - 包含“启用可分享链接功能”参数的布尔值
  • shareable_link_text - 包含“可分享链接文本”参数的字符串
  • shareable_link_hint_text - 包含“可分享链接提示文本”参数的字符串
  • shareable_link_success_text - 包含“可分享链接成功文本”参数的字符串
  • is_load_linked_product_enabled - 包含“启用加载关联产品功能”参数的布尔值
  • is_enabled_fide_value_price - 包含“启用隐藏值价格功能”参数的布尔值
  • is_enabled_hide_product_page_value_price - 包含“启用产品页面上'隐藏值价格'功能”参数的布尔值
  • is_enabled_customize_and_add_to_cart_button - 包含“启用'自定义并添加到购物车'按钮”参数的布尔值
  • is_show_swatch_title - 包含“显示为标题”参数的布尔值
  • is_show_swatch_price - 包含“在色块中显示价格”参数的布尔值
  • swatch_width - 包含“色块宽度”参数的整数
  • swatch_height - 包含“色块高度”参数的整数
  • text_swatch_max_width - 包含“色块最大宽度”参数的字符串
  • is_enabled_option_inventory - 包含“启用选项库存功能”参数的布尔值
  • is_display_option_inventory_on_frontend - 包含“在前端显示选项数量”参数的布尔值
  • is_display_out_of_stock_message - 包含“显示缺货消息”参数的布尔值
  • is_display_out_of_stock_message_on_options_level - 包含“在选项级别显示缺货消息”参数的布尔值
  • is_display_out_of_stock_options - 包含“缺货选项。如果为真 - 禁用缺货选项;如果为假 - 隐藏”参数的布尔值
  • is_require_hidden_out_of_stock_options - 包含“显示必需的'缺货'选项”参数的布尔值
  • is_special_price_enabled - 包含“检查是否启用特惠价格”参数的布尔值
  • is_tier_price_enabled - 包含“检查是否启用阶梯价格”参数的布尔值
  • is_display_tier_price_table_needed - 包含“检查是否需要显示阶梯价格表”参数的布尔值

产品扩展配置

此查询包含不同的参数,可以帮助您在前端处理高级产品选项。

产品扩展配置请求
{
  productExtendConfig (
      productSku: "testMW"
      qty: 1
  ) {
      option_json_config
      product_json_config
      locale_price_format
      product_final_price_incl_tax
      product_final_price_excl_tax
      product_regular_price_incl_tax
      product_regular_price_excl_tax
      price_display_mode
      catalog_price_contains_tax
  }
}
产品扩展配置响应
{
  "data": {
    "productExtendConfig": {
      "option_json_config": "{\"170\":{\"1087\":{\"prices\":{\"oldPrice\":{\"amount\":1,\"amount_excl_tax\":1,\"amount_incl_tax\":1},\"basePrice\":{\"amount\":1},\"finalPrice\":{\"amount\":1}},\"type\":\"fixed\",\"name\":\"1\",\"stockMessage\":\"(111)\",\"valuePrice\":\"$1.00\",\"tier_price_display_data\":[],\"title\":\"1\"},\"1088\":{\"prices\":{\"oldPrice\":{\"amount\":110,\"amount_excl_tax\":110,\"amount_incl_tax\":110},\"basePrice\":{\"amount\":90},\"finalPrice\":{\"amount\":90}},\"type\":\"fixed\",\"name\":\"2\",\"stockMessage\":\"(222)\",\"valuePrice\":\"$110.00\",\"special_price_display_node\":\"+$90.00 (Regular Price: $110.00. )\",\"tier_price_display_data\":[],\"title\":\"2\"},\"1089\":{\"prices\":{\"oldPrice\":{\"amount\":123,\"amount_excl_tax\":123,\"amount_incl_tax\":123},\"basePrice\":{\"amount\":123},\"finalPrice\":{\"amount\":123}},\"type\":\"fixed\",\"name\":\"3\",\"stockMessage\":\"(333)\",\"valuePrice\":\"$123.00\",\"tier_price_display_data\":{\"3\":{\"price\":100,\"customer_group_id\":\"32000\",\"price_type\":\"fixed\",\"date_from\":\"\",\"date_to\":\"\",\"qty\":\"3\",\"price_incl_tax\":100,\"percent\":19},\"4\":{\"price\":90,\"customer_group_id\":\"32000\",\"price_type\":\"fixed\",\"date_from\":\"\",\"date_to\":\"\",\"qty\":\"4\",\"price_incl_tax\":90,\"percent\":27},\"5\":{\"price\":80,\"customer_group_id\":\"32000\",\"price_type\":\"fixed\",\"date_from\":\"\",\"date_to\":\"\",\"qty\":\"5\",\"price_incl_tax\":80,\"percent\":35}},\"title\":\"3\"}},\"171\":{\"1090\":{\"prices\":{\"oldPrice\":{\"amount\":22,\"amount_excl_tax\":22,\"amount_incl_tax\":22},\"basePrice\":{\"amount\":22},\"finalPrice\":{\"amount\":22}},\"type\":\"fixed\",\"name\":\"r1\",\"valuePrice\":\"$22.00\",\"tier_price_display_data\":[],\"title\":\"r1\"},\"1091\":{\"prices\":{\"oldPrice\":{\"amount\":11,\"amount_excl_tax\":11,\"amount_incl_tax\":11},\"basePrice\":{\"amount\":11},\"finalPrice\":{\"amount\":11}},\"type\":\"fixed\",\"name\":\"r2\",\"valuePrice\":\"$11.00\",\"tier_price_display_data\":[],\"title\":\"r2\"}},\"172\":{\"1092\":{\"prices\":{\"oldPrice\":{\"amount\":1,\"amount_excl_tax\":1,\"amount_incl_tax\":1},\"basePrice\":{\"amount\":1},\"finalPrice\":{\"amount\":1}},\"type\":\"fixed\",\"name\":\"c1\",\"valuePrice\":\"$1.00\",\"tier_price_display_data\":[],\"title\":\"c1\"},\"1093\":{\"prices\":{\"oldPrice\":{\"amount\":2,\"amount_excl_tax\":2,\"amount_incl_tax\":2},\"basePrice\":{\"amount\":2},\"finalPrice\":{\"amount\":2}},\"type\":\"fixed\",\"name\":\"c2\",\"valuePrice\":\"$2.00\",\"tier_price_display_data\":[],\"title\":\"c2\"},\"1094\":{\"prices\":{\"oldPrice\":{\"amount\":3,\"amount_excl_tax\":3,\"amount_incl_tax\":3},\"basePrice\":{\"amount\":3},\"finalPrice\":{\"amount\":3}},\"type\":\"fixed\",\"name\":\"c3\",\"valuePrice\":\"$3.00\",\"tier_price_display_data\":[],\"title\":\"c3\"}},\"173\":{\"1095\":{\"prices\":{\"oldPrice\":{\"amount\":0,\"amount_excl_tax\":0,\"amount_incl_tax\":0},\"basePrice\":{\"amount\":0},\"finalPrice\":{\"amount\":0}},\"type\":\"fixed\",\"name\":\"m1\",\"valuePrice\":\"$0.00\",\"tier_price_display_data\":[],\"title\":\"m1\"},\"1096\":{\"prices\":{\"oldPrice\":{\"amount\":0,\"amount_excl_tax\":0,\"amount_incl_tax\":0},\"basePrice\":{\"amount\":0},\"finalPrice\":{\"amount\":0}},\"type\":\"fixed\",\"name\":\"m2\",\"valuePrice\":\"$0.00\",\"tier_price_display_data\":[],\"title\":\"m2\"},\"1097\":{\"prices\":{\"oldPrice\":{\"amount\":0,\"amount_excl_tax\":0,\"amount_incl_tax\":0},\"basePrice\":{\"amount\":0},\"finalPrice\":{\"amount\":0}},\"type\":\"fixed\",\"name\":\"m3\",\"valuePrice\":\"$0.00\",\"tier_price_display_data\":[],\"title\":\"m3\"}},\"174\":{\"1098\":{\"prices\":{\"oldPrice\":{\"amount\":0,\"amount_excl_tax\":0,\"amount_incl_tax\":0},\"basePrice\":{\"amount\":0},\"finalPrice\":{\"amount\":0}},\"type\":\"fixed\",\"name\":\"s1\",\"valuePrice\":\"$0.00\",\"tier_price_display_data\":[],\"title\":\"s1\"},\"1099\":{\"prices\":{\"oldPrice\":{\"amount\":0,\"amount_excl_tax\":0,\"amount_incl_tax\":0},\"basePrice\":{\"amount\":0},\"finalPrice\":{\"amount\":0}},\"type\":\"fixed\",\"name\":\"s2\",\"valuePrice\":\"$0.00\",\"tier_price_display_data\":[],\"title\":\"s2\"},\"1100\":{\"prices\":{\"oldPrice\":{\"amount\":0,\"amount_excl_tax\":0,\"amount_incl_tax\":0},\"basePrice\":{\"amount\":0},\"finalPrice\":{\"amount\":0}},\"type\":\"fixed\",\"name\":\"s3\",\"valuePrice\":\"$0.00\",\"tier_price_display_data\":[],\"title\":\"s3\"},\"1101\":{\"prices\":{\"oldPrice\":{\"amount\":0,\"amount_excl_tax\":0,\"amount_incl_tax\":0},\"basePrice\":{\"amount\":0},\"finalPrice\":{\"amount\":0}},\"type\":\"fixed\",\"name\":\"s4\",\"valuePrice\":\"$0.00\",\"tier_price_display_data\":[],\"title\":\"s4\"}},\"175\":{\"prices\":{\"oldPrice\":{\"amount\":100,\"amount_excl_tax\":100,\"amount_incl_tax\":100},\"basePrice\":{\"amount\":100},\"finalPrice\":{\"amount\":100}},\"type\":\"fixed\",\"name\":\"area default\",\"valuePrice\":\"$100.00\",\"title\":\"area default\"},\"176\":{\"prices\":{\"oldPrice\":{\"amount\":200,\"amount_excl_tax\":200,\"amount_incl_tax\":200},\"basePrice\":{\"amount\":200},\"finalPrice\":{\"amount\":200}},\"type\":\"fixed\",\"name\":\"field deafult\",\"valuePrice\":\"$200.00\",\"title\":\"field deafult\"},\"177\":{\"prices\":{\"oldPrice\":{\"amount\":300,\"amount_excl_tax\":300,\"amount_incl_tax\":300},\"basePrice\":{\"amount\":300},\"finalPrice\":{\"amount\":300}},\"type\":\"fixed\",\"name\":\"date\",\"valuePrice\":\"$300.00\",\"title\":\"date\"}}",
      "product_json_config": "{\"absolute_price\":\"1\",\"type_id\":\"simple\",\"extended_tier_prices\":[],\"regular_price_excl_tax\":123,\"regular_price_incl_tax\":123,\"final_price_excl_tax\":123,\"final_price_incl_tax\":123,\"is_display_both_prices\":false,\"price\":123}",
      "locale_price_format": "{\"pattern\":\"$%s\",\"precision\":2,\"requiredPrecision\":2,\"decimalSymbol\":\".\",\"groupSymbol\":\",\",\"groupLength\":3,\"integerRequired\":false,\"priceSymbol\":\"$\"}",
      "product_final_price_incl_tax": 123,
      "product_final_price_excl_tax": 123,
      "product_regular_price_incl_tax": 123,
      "product_regular_price_excl_tax": 123,
      "price_display_mode": 1,
      "catalog_price_contains_tax": false
    }
  }
}

“ProductExtendConfig”响应包含params,其中包含以下键

  • option_json_config - 包含选项配置的json
  • product_json_config - 包含产品配置的json
  • locale_price_format - 包含本地价格格式的json
  • product_final_price_incl_tax - 包含包含税的产品最终价格的浮点数参数
  • product_final_price_excl_tax - 包含不含税的产品最终价格的浮点数参数
  • product_regular_price_incl_tax - 包含包含税的产品常规价格的浮点数参数
  • product_regular_price_excl_tax - 包含不含税的产品常规价格的浮点数参数
  • price_display_mode - 包含价格显示模式参数的整数
  • catalog_price_contains_tax - 包含目录价格是否包含税的布尔值参数

“option_json_config”包含所有包含和不含税的价值价格,还包括已准备显示格式的层和特殊值数据。

“product_json_config”包含高级产品选项属性、产品层价格数据、产品类型、包含和不含税的常规和最终产品价格以及产品价格显示模式。

“locale_price_format”包含用于显示产品价格格式的参数。

产品最终价格

查询包含基本和最终产品价格,这些价格包含所选选项和选项值的总价

产品最终价格请求
{
    productFinalPrice (
        productSku: "testMW"
        currentOptions: "{\"170\":\"1088\",\"175\":\"\"}"
        currentQty: 1
    ) {
        final_price
        base_price
    }
}
产品最终价格响应
{
  "data": {
    "productFinalPrice": {
      "final_price": 190,
      "base_price": 190
    }
  }
}

“ProductFinalPrice”请求包含以下参数

  • productSku - 产品SKU
  • currenctOptions - 它是包含所选选项和选项值的json。例如条件:{"170":"1088","175":""},其中
    --- "170"和"175" - 选项ID
    --- "1088" - 选项值ID
  • currentQty - 当前产品数量。注意:仅对于“可选择的”选项存在值。对于“字段”之类的选项类型,"value ID"将为空。

“ProductFinalPrice”响应包含使用此查询计算的实际基本和最终价格,包括以下键

  • base_price - 包含基本产品价格参数的浮点数
  • final_price - 包含最终产品价格参数的浮点数

色卡媒体数据

包含有关高级产品选项色卡功能的全部数据。它类似于图像路径、角色、模式等。

色卡媒体数据请求
{
    swatchMediaData (
        productSku: "testMW"
        width: 90
        height: 90
    ) {
        swatch_media_data
    }
}
色卡媒体数据响应
{
  "data": {
    "swatchMediaData": {
      "swatch_media_data": "{\"options\":{\"170\":{\"type\":\"drop_down\",\"mageworx_option_gallery\":\"0\",\"mageworx_option_image_mode\":\"0\",\"sort_order\":\"1\",\"values\":{\"1087\":{\"sort_order\":\"1\",\"images\":{\"667\":{\"value_id\":\"667\",\"option_type_id\":\"1087\",\"position\":\"1\",\"file\":\"\\/8\\/a\\/8a288a.jpg\",\"label\":\"\",\"custom_media_type\":\"color\",\"color\":\"8a288a\",\"disabled\":\"0\",\"url\":\"http:\\/\\/magento246.test\\/media\\/mageworx\\/optionfeatures\\/product\\/option\\/value\\/8\\/a\\/35x35\\/8a288a.jpg\",\"replace_main_gallery_image\":\"1\",\"overlay_image\":\"0\",\"base_image\":\"1\",\"tooltip_image\":\"1\",\"full\":\"http:\\/\\/magento246.test\\/media\\/mageworx\\/optionfeatures\\/product\\/option\\/value\\/8\\/a\\/8a288a.jpg\",\"img\":\"http:\\/\\/magento246.test\\/media\\/mageworx\\/optionfeatures\\/product\\/option\\/value\\/8\\/a\\/8a288a.jpg\",\"thumb\":\"http:\\/\\/magento246.test\\/media\\/mageworx\\/optionfeatures\\/product\\/option\\/value\\/8\\/a\\/90x90\\/8a288a.jpg\"}},\"overlay_image_url\":\"\"},\"1088\":{\"sort_order\":\"2\"},\"1089\":{\"sort_order\":\"3\"}}},\"171\":{\"type\":\"radio\",\"mageworx_option_gallery\":\"1\",\"mageworx_option_image_mode\":\"1\",\"sort_order\":\"2\",\"values\":{\"1090\":{\"sort_order\":\"1\",\"images\":{\"668\":{\"value_id\":\"668\",\"option_type_id\":\"1090\",\"position\":\"1\",\"file\":\"\\/0\\/0\\/0034e0.jpg\",\"label\":\"\",\"custom_media_type\":\"color\",\"color\":\"0034e0\",\"disabled\":\"0\",\"url\":\"http:\\/\\/magento246.test\\/media\\/mageworx\\/optionfeatures\\/product\\/option\\/value\\/0\\/0\\/35x35\\/0034e0.jpg\",\"replace_main_gallery_image\":\"1\",\"overlay_image\":\"0\",\"base_image\":\"1\",\"tooltip_image\":\"1\",\"full\":\"http:\\/\\/magento246.test\\/media\\/mageworx\\/optionfeatures\\/product\\/option\\/value\\/0\\/0\\/0034e0.jpg\",\"img\":\"http:\\/\\/magento246.test\\/media\\/mageworx\\/optionfeatures\\/product\\/option\\/value\\/0\\/0\\/0034e0.jpg\",\"thumb\":\"http:\\/\\/magento246.test\\/media\\/mageworx\\/optionfeatures\\/product\\/option\\/value\\/0\\/0\\/90x90\\/0034e0.jpg\"}},\"overlay_image_url\":\"\"},\"1091\":{\"sort_order\":\"2\",\"images\":{\"669\":{\"value_id\":\"669\",\"option_type_id\":\"1091\",\"position\":\"1\",\"file\":\"\\/b\\/f\\/bf64bf.jpg\",\"label\":\"\",\"custom_media_type\":\"color\",\"color\":\"bf64bf\",\"disabled\":\"0\",\"url\":\"http:\\/\\/magento246.test\\/media\\/mageworx\\/optionfeatures\\/product\\/option\\/value\\/b\\/f\\/35x35\\/bf64bf.jpg\",\"replace_main_gallery_image\":\"1\",\"overlay_image\":\"0\",\"base_image\":\"1\",\"tooltip_image\":\"1\",\"full\":\"http:\\/\\/magento246.test\\/media\\/mageworx\\/optionfeatures\\/product\\/option\\/value\\/b\\/f\\/bf64bf.jpg\",\"img\":\"http:\\/\\/magento246.test\\/media\\/mageworx\\/optionfeatures\\/product\\/option\\/value\\/b\\/f\\/bf64bf.jpg\",\"thumb\":\"http:\\/\\/magento246.test\\/media\\/mageworx\\/optionfeatures\\/product\\/option\\/value\\/b\\/f\\/90x90\\/bf64bf.jpg\"}},\"overlay_image_url\":\"\"}}},\"172\":{\"type\":\"checkbox\",\"mageworx_option_gallery\":\"0\",\"mageworx_option_image_mode\":\"0\",\"sort_order\":\"3\",\"values\":{\"1092\":{\"sort_order\":\"1\"},\"1093\":{\"sort_order\":\"2\"},\"1094\":{\"sort_order\":\"3\"}}},\"173\":{\"type\":\"multiple\",\"mageworx_option_gallery\":\"0\",\"mageworx_option_image_mode\":\"0\",\"sort_order\":\"4\",\"values\":{\"1095\":{\"sort_order\":\"1\"},\"1096\":{\"sort_order\":\"2\"},\"1097\":{\"sort_order\":\"3\"}}},\"174\":{\"type\":\"drop_down\",\"mageworx_option_gallery\":\"0\",\"mageworx_option_image_mode\":\"0\",\"sort_order\":\"5\",\"values\":{\"1098\":{\"sort_order\":\"1\"},\"1099\":{\"sort_order\":\"2\"},\"1100\":{\"sort_order\":\"3\"},\"1101\":{\"sort_order\":\"4\"}}}},\"option_types\":[\"field\",\"area\",\"file\",\"drop_down\",\"radio\",\"checkbox\",\"multiple\",\"date\",\"date_time\",\"time\"],\"render_images_for_option_types\":[\"drop_down\",\"radio\",\"checkbox\",\"multiple\"],\"option_gallery_type\":{\"disabled\":0,\"beside_option\":1,\"once_selected\":2}}"
    }
  }
}

“SwatchMediaData”响应包含params,包括以下键

  • swatch_media_data - 包含色卡媒体数据的json