thousandmonkeys/m2-flatcategories-module v1.0.1

A flat category rest endpoint for magento2 to work round the stupidity that is the default tree interface.

Type

magento2-module

License

OSL-3.0, AFL-3.0

Requires

None

Requires (dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

flatCategory-magento2

A flat category rest endpoint for magento2 to work round the stupidity that is the default tree interface. This just gives a list of all categories with searchCriteria supported to make caching and lookups easy, instead of hard and annoying.

Installation

  • composer require thousandmonkeys/m2-flatcategories-module
  • php bin/magento deploy:mode:set developer
  • php bin/magento setup:upgrade
  • php bin/magento setup:di:compile
  • php bin/magento deploy:mode:set production
  • php bin/magento maintenance:disable

Usage

GET rest/V1/flatCategories?searchCriteria Response:

{
  "items": [
    {
      "id": 0,
      "parent_id": 0,
      "name": "string",
      "is_active": true,
      "position": 0,
      "level": 0,
      "children": "string",
      "created_at": "string",
      "updated_at": "string",
      "path": "string",
      "available_sort_by": [
        "string"
      ],
      "include_in_menu": true,
      "extension_attributes": {},
      "custom_attributes": [
        {
          "attribute_code": "string",
          "value": "string"
        }
      ]
    }
  ],
  "search_criteria": {
    "filter_groups": [
      {
        "filters": [
          {
            "field": "string",
            "value": "string",
            "condition_type": "string"
          }
        ]
      }
    ],
    "sort_orders": [
      {
        "field": "string",
        "direction": "string"
      }
    ],
    "page_size": 0,
    "current_page": 0
  },
  "total_count": 0
}