mar-pod-b2b / module-b2b-company-hierarchy
Organizational units, branches, and company hierarchies for Marpod B2B Advanced.
Package info
gitlab.com/mar-pod-b2b/module-b2b-company-hierarchy
Type:magento2-module
pkg:composer/mar-pod-b2b/module-b2b-company-hierarchy
Requires
- php: ^8.5
- magento/framework: ^103.0
- magento/module-graph-ql: ^100.4
- magento/module-store: ^101.1
- magento/module-webapi: ^100.4
- mar-pod-b2b/module-b2b-company: ^1.0
- mar-pod-b2b/module-b2b-core: ^1.0
This package is auto-updated.
Last update: 2026-08-21 11:38:49 UTC
README
Organizational units, branches, and subsidiaries within a single B2B Light company.
Status
Full hierarchy engine and Admin UI shipped. The module extends Marpod_B2bCompany without
changing what company_id means — the hierarchy lives in its own tables, so Light-only data
stays valid whether or not this add-on is installed.
Implemented foundation
- declarative schema:
marpod_b2b_company_hierarchy_unit(branches/units, tree-structured per company),marpod_b2b_company_hierarchy_membership(customer-to-unit assignment),marpod_b2b_company_hierarchy_override(per-unit role/pricing/limit overrides); HierarchyUnitRepositoryInterface/HierarchyManagementInterface— create branches, move a unit to a new parent, delete a unit;HierarchyMembershipRepositoryInterface— assign or unassign a customer to a specific unit (a customer belongs to at most one unit at a time within a company);HierarchyOverrideRepositoryInterface/HierarchyOverrideResolverInterface— a unit can override an inherited role, price list, or limit; the resolver walks up the tree to the nearest ancestor with an explicit override, falling back to the company-wide default when no unit in the chain has one;- aggregated order/spend views for a parent unit roll up figures from every descendant unit.
Admin UI
Marpod_B2bCompanyHierarchy::manage (marpod_b2b_company_hierarchy/unit/index) provides a unit
tree with create-branch, move, delete, member assign/unassign, and override save/delete actions.
Requirements
- PHP 8.5
- Magento 2.4.9-compatible framework packages
mar-pod-b2b/module-b2b-core,mar-pod-b2b/module-b2b-company
Installation
Run from the Magento project root:
composer require mar-pod-b2b/module-b2b-company-hierarchy:^1.1
bin/magento module:enable Marpod_B2bCompanyHierarchy
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
Development
The planned scope, dependency rules, cache boundaries, security requirements, and test strategy
are documented in packages/B2B_LIGHT_PLAN.md in the development Magento project (section 9.1).
Unit tests:
vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist packages/module-b2b-company-hierarchy/Test/Unit
REST/GraphQL API tests (real HTTP against a running instance — routing, authentication, ACL
enforcement, and cross-company isolation; see mar-pod-b2b/module-b2b-core's README for the
shared Test/Api base classes these build on):
vendor/bin/phpunit -c dev/tests/api-functional/phpunit_rest.xml \
packages/module-b2b-company-hierarchy/Test/Api/Rest/HierarchyUnitRestTest.php
vendor/bin/phpunit -c dev/tests/api-functional/phpunit_graphql.xml \
packages/module-b2b-company-hierarchy/Test/Api/GraphQl/CompanyHierarchyGraphQlTest.php
Limitations
- a customer belongs to exactly one unit at a time — no cross-unit/matrix membership;
- override resolution covers role, price list, and limit only; other Advanced add-ons (Budget,
Advanced Pricing) integrate with the hierarchy through a bare
unit_idfield rather than a hard dependency, so they do not automatically respect override inheritance.
Uninstallation
Do not remove the package while another installed module requires it. The
marpod_b2b_company_hierarchy_* tables contain business data and are retained when the module
is disabled or its package is removed — removing it does not touch Marpod_B2bCompany's own
tables or company_id values.