Search by

mar-pod-b2b / module-b2b-advanced-pricing

Contract, volume, scheduled, and rule-based company pricing for Marpod B2B Advanced.

Maintainers

Package info

gitlab.com/mar-pod-b2b/module-b2b-advanced-pricing

Issues

Type:magento2-module

pkg:composer/mar-pod-b2b/module-b2b-advanced-pricing

Transparency log

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

1.1.9 2026-08-24 16:09 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 to Marpod_B2bPricing's existing single assignment, so Light-only pricing data stays valid), marpod_b2b_advanced_pricing_tier (quantity break points per price list — the highest min_qty not 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 the PriceRuleMatcherInterface pool — category and attribute matchers 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 as published, 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_price table — 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 frozen CompanyPriceResolverInterface contract (see B2B_LIGHT_PLAN.md section 6a) is not modified; instead its DI preference is swapped for CompanyPriceResolverOverride, which delegates to the new resolver with quantity=1. This means the new pricing engine reaches PDP/listing pricing (via the existing CompanyPriceOverlayApplier from Marpod_B2bDynamicProductData) and real cart-line pricing (via QuoteItemDynamicPriceApplier) automatically, with no change required in Marpod_B2bDynamicProductData itself.

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-pricing
  • mar-pod-b2b/module-b2b-company for 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.