mar-pod-b2b / module-b2b-advanced-pricing
Contract, volume, scheduled, and rule-based company pricing for Marpod B2B Advanced.
Package info
gitlab.com/mar-pod-b2b/module-b2b-advanced-pricing
Type:magento2-module
pkg:composer/mar-pod-b2b/module-b2b-advanced-pricing
Requires
- php: ^8.5
- magento/framework: ^103.0
- magento/module-catalog: ^104.0
- magento/module-indexer: ^100.4
- magento/module-webapi: ^100.4
- mar-pod-b2b/module-b2b-company: ^1.0
- mar-pod-b2b/module-b2b-core: ^1.0
- mar-pod-b2b/module-b2b-pricing: ^1.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-08-24 16:10:31 UTC
README
Multiple prioritized price lists per company, quantity tiers, category/attribute discount rules,
and a lightweight publish-approval gate — layered on top of Marpod_B2bPricing without
duplicating it.
Status
Full pricing engine and Admin UI shipped.
Implemented foundation
- declarative schema:
marpod_b2b_advanced_pricing_assignment(company-to-price-list assignments with a priority, stacked above the base module's single assignment — a company with no Advanced Pricing assignment falls back toMarpod_B2bPricing's existing single assignment, so Light-only pricing data stays valid),marpod_b2b_advanced_pricing_tier(quantity break points per price list — the highestmin_qtynot exceeding the requested quantity wins, resolved before contract price and discount rules are applied),marpod_b2b_advanced_pricing_rule(category/attribute percentage or fixed-amount discounts, matched through thePriceRuleMatcherInterfacepool —categoryandattributematchers ship today; new match types are additional pool members, not core changes),marpod_b2b_advanced_pricing_status(draft/pending_approval/published per price list — a price list with no status row is treated aspublished, for backward compatibility with price lists that predate this module; only explicitly-withdrawn lists are skipped); - contract prices with a validity window and multi-currency support are inherited directly from
the base module's
marpod_b2b_pricetable — this module does not duplicate that mechanism, only layers resolution priority, tiers, and rules on top of it; AdvancedPriceResolverInterface::resolveForQuantity()— the new, quantity-aware resolution entry point. The frozenCompanyPriceResolverInterfacecontract (seeB2B_LIGHT_PLAN.mdsection 6a) is not modified; instead its DI preference is swapped forCompanyPriceResolverOverride, which delegates to the new resolver with quantity=1. This means the new pricing engine reaches PDP/listing pricing (via the existingCompanyPriceOverlayApplierfromMarpod_B2bDynamicProductData) and real cart-line pricing (viaQuoteItemDynamicPriceApplier) automatically, with no change required inMarpod_B2bDynamicProductDataitself.
Admin UI
Marpod_B2bAdvancedPricing::manage (marpod_b2b_advanced_pricing/advanced/index) provides
company assignment, tier and rule management, and status transitions (draft → pending_approval →
published). The Manage screen uses persistent Magento Admin tabs. Assigned companies, quantity
tiers, and discount rules provide independent filtering, record counts, page-size selection, and
pagination; action forms are separated below their grids.
REST
Admin/ERP REST routes below /rest/V1/marpod-b2b/advanced-pricing require the same
Marpod_B2bAdvancedPricing::manage ACL resource the Admin UI already uses — no new ACL resource
was needed. They mirror the Admin UI's own surface: rule/tier/assignment CRUD and status
get/set/approve. No GraphQL is exposed here by design — internal pricing rules stay off that
surface; extend Magento's own catalog price GraphQL output instead if a storefront needs the
resolved price.
Requirements
- PHP 8.5
- Magento 2.4.9-compatible framework packages
mar-pod-b2b/module-b2b-core,mar-pod-b2b/module-b2b-pricingmar-pod-b2b/module-b2b-companyfor company details in the assignment grid
Installation
Run from the Magento project root:
composer require mar-pod-b2b/module-b2b-advanced-pricing:^1.1
bin/magento module:enable Marpod_B2bAdvancedPricing
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.3).
Unit tests:
vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist packages/module-b2b-advanced-pricing/Test/Unit
Admin smoke test:
cd packages/module-b2b-advanced-pricing/Test/Playwright
npm install
npm test
REST 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-advanced-pricing/Test/Api/Rest/AdvancedPricingRestTest.php
Limitations
- the draft/pending_approval/published field is a status gate, not full price-list versioning — there is no change history or scheduled-publish date;
- discount rule matching covers category and attribute only.
Uninstallation
Do not remove the package while another installed module requires it. The
marpod_b2b_advanced_pricing_* tables contain business data and are retained when the module is
disabled or its package is removed; removing it reverts pricing to the base
Marpod_B2bPricing single-assignment resolution.