Download the PHP package orangecat/module-prices-company without Composer

On this page you can find all versions of the php package orangecat/module-prices-company. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package module-prices-company

Orangecat_PricesCompany

Per-company, per-SKU, quantity-aware custom pricing rules for Magento 2 B2B.

Module: Orangecat_PricesCompany Version: 1.0.0 License: OSL-3.0 Author: Oliverio Gombert [email protected]


Table of Contents

  1. Overview
  2. Theme Compatibility
  3. Requirements
  4. Installation
  5. What Gets Installed
  6. Configuration
  7. Store Admin Guide
  8. Developer Guide
  9. REST API
  10. Frontend Routes Reference
  11. DevOps & Integrator Notes

Overview

Orangecat_PricesCompany attaches company-specific pricing rules directly to a company entity. Each rule targets a single SKU at a minimum purchase quantity and applies one of three discount strategies: a fixed final price, a flat amount off, or a percentage off. Rules are quantity-tiered: the highest-matching threshold applies, enabling volume pricing per company.

The module registers a PricesCompanyCalculator into the Orangecat_Prices orchestrator pool. The orchestrator calls every registered calculator in sequence; this module's calculator returns a price (or null if no rule matches) and the orchestrator applies it to the product.

Responsibilities:

Position in the Orangecat B2B Dependency Chain

Price Resolution Strategy

When the Prices orchestrator resolves the final price for a product, it passes a $basePrice to each registered calculator. This module's behavior depends on the Price Resolution Strategy setting:

Mode Description
Overwrite (default) The company rule is applied against the catalog base price, ignoring any upstream discount (e.g., from PricesList). Company rule wins absolutely.
Stack The $basePrice received is already adjusted by earlier calculators (e.g., a PricesList discount). The company rule stacks on top, compounding discounts.

Discount Types

Value Label Calculation
fixed_price Fixed Price Override Final price = amount (ignores base price)
fixed_amount Fixed Amount Discount Final price = base_price - amount
percentage Percentage Discount Final price = base_price × (1 - amount/100)

For fixed_amount and percentage, the base_price used is determined by the resolution mode (see above). The calculated price is floored at 0.0 and never goes negative.

Tier Pricing

Multiple rules for the same company + SKU at different qty thresholds create volume tiers. The calculator picks the rule with the highest qty that is ≤ the requested quantity. The getTiers() method returns all tier breakpoints (qty > 1) for display on the product page.


Theme Compatibility

Theme Status Notes
Luma Supported No frontend templates. Pricing applies transparently via the Prices orchestrator.
Hyvä Supported No frontend templates. Pricing applies transparently via the Prices orchestrator.
Breeze Evolution Supported No frontend templates. Pricing applies transparently via the Prices orchestrator.

This module has no frontend views. All pricing logic runs server-side inside the orchestrator pool and surfaces through the standard catalog price layer, making it theme-agnostic.


Requirements

Dependency Version / Notes
Magento 2 2.4.x
PHP ≥ 8.1
orangecat/core composer dependency
Orangecat_Company must be enabled (provides mycompany table and CompanyRepositoryInterface)
Orangecat_Prices must be enabled (provides the CalculatorPool injection point)
Magento_ImportExport for CSV import support
Magento_Catalog for product lookup during import and calculation

Installation

This module ships as a git submodule of the main B2B SDK repository.


What Gets Installed

Database Tables

pricescompany_item — Flat table storing per-company pricing rules.

Column Type Notes
item_id INT UNSIGNED AUTO_INCREMENT Primary key
company_id INT UNSIGNED NOT NULL FK → mycompany.entity_id ON DELETE CASCADE
sku VARCHAR(64) NOT NULL Product SKU
qty DECIMAL(12,4) NOT NULL DEFAULT 1.0000 Minimum quantity threshold for this rule
discount_type VARCHAR(32) NOT NULL DEFAULT fixed_price One of: fixed_price, fixed_amount, percentage
amount DECIMAL(12,4) NOT NULL DEFAULT 0.0000 Price, flat discount amount, or percentage value
created_at TIMESTAMP Set on insert
updated_at TIMESTAMP Updated automatically on every write

Constraints and indexes:

EAV Attributes

None.

Data Patches

None. No default records are created on install.


Configuration

Settings live under Stores > Configuration > Prices > Company Custom Prices.

Company Custom Prices (prices/pricescompany)

Label Config path Default Description
Enable Custom Company Prices prices/pricescompany/enabled Yes Master switch. When disabled, the calculator always returns null and has no effect on pricing.
Price Resolution Strategy prices/pricescompany/resolution_mode overwrite Controls what base_price is passed to the calculator. See Price Resolution Strategy. Only visible when enabled = Yes.

The resolution_mode field accepts two values: overwrite and stack.


Store Admin Guide

Navigation

Catalog > Manage Company Prices

This menu item opens the Company Prices index, a grid listing all companies from the mycompany table.

Company Prices Index

The grid shows every company with columns for company name and ID. From here you can:

Company Edit Screen — Pricing Rules Grid

Opening a company shows its item grid: all custom pricing rules for that company.

Available columns in the item grid:

Column Description
SKU Product SKU the rule applies to
Qty Minimum quantity threshold
Discount Type Fixed Price Override, Fixed Amount Discount, or Percentage Discount
Amount Price, deduction amount, or percentage depending on type

Adding rules — "Add Products" button:

  1. Click Add Products. A product selector modal opens (standard Magento catalog grid).
  2. Select one or more products and click the Add button.
  3. A pricing dialog appears with one row per selected product, pre-filled with the catalog price.
  4. For each row, choose the Discount Type and enter the Amount. Optionally adjust the Qty threshold (defaults to 1).
  5. Click Confirm & Add. The rules are saved immediately via AJAX and the item grid reloads.

Inline editing:

Double-click any cell in the Qty, Amount, or Discount Type columns to edit it inline. Changes save automatically on blur.

Deleting rules:

CSV Import

Navigate to System > Import, select entity type Company Custom Prices, and upload a CSV file.

Required CSV columns: company_id, sku, qty, discount_type, amount.

A sample file is available at Files/Sample/pricescompany_item.csv:

Supported behaviors: Add/Update (append), Replace, Delete.

Validation checks:


Developer Guide

Module Structure

Key Classes

Service Contracts

Interface Implementation Description
Api\Data\PricesCompanyItemInterface Model\PricesCompanyItem Data object for a single pricing rule
Api\PricesCompanyItemRepositoryInterface Model\PricesCompanyItemRepository CRUD: getById, save, delete, deleteById, getList
Api\PricesCompanyItemManagementInterface Model\PricesCompanyItemManagement calculateFinalPrice, saveBulk, deleteByCompanyId, deleteBySku

Calculator

Model\Calculator\PricesCompanyCalculator implements Orangecat\Prices\Api\PriceCalculatorInterface:

Selects the highest-matching quantity rule (qty <= $qty, ordered DESC) and applies the discount. Returns null if the module is disabled or no rule matches (the orchestrator then tries other calculators or falls back to the catalog price).

Returns all quantity tiers (qty > 1) as [['qty' => float, 'price' => float], ...] for storefront display.

Config

Model\Config provides typed access to the two system settings:

Observers

This module registers no observers.

Plugins

This module registers no plugins.

JS Components (Admin)

File Extends Purpose
view/adminhtml/web/js/add-products.js Magento_Ui/js/form/components/button Orchestrates the two-step product selection and pricing dialog flow. On click: reads selected product IDs from the UI component selections provider, fetches product details via AJAX (GetProducts), renders a pricing dialog with per-row discount configuration, then POSTs the result to Item/Add. On success, reloads the item listing.

Email Templates

This module sends no email notifications.

ACL Resources

Resource ID Title Location in ACL tree
Orangecat_PricesCompany::manage Manage Company Prices Admin > Catalog

Adding Custom Logic


REST API

All endpoints except /calculate require the ACL resource Orangecat_PricesCompany::manage. The /calculate endpoint is anonymous — apply token-based access control at the integration level if needed.

Endpoints

Method Endpoint Description
GET /V1/pricescompany/items/search Search pricing rules using standard SearchCriteria
GET /V1/pricescompany/calculate Calculate the final price for a company/SKU/qty combination
POST /V1/pricescompany/items/bulk Bulk upsert pricing rules (uses INSERT ON DUPLICATE KEY UPDATE)
PUT /V1/pricescompany/items/bulk Same as POST bulk — idempotent upsert
DELETE /V1/pricescompany/items/company/:companyId Delete all pricing rules for a company
DELETE /V1/pricescompany/items/sku/:sku Delete all pricing rules for a SKU across all companies

Authentication

Generate an integration token with the Orangecat_PricesCompany::manage ACL resource, then pass it as a Bearer token.

Examples

Search rules for company 1:

Calculate final price:

Response: float — the resolved final price (falls back to catalog base price if no rule matches).

Bulk upsert:

Response: true on success.

Delete all rules for company 2:

Delete all rules for a SKU:


Frontend Routes Reference

This module has no frontend routes. All user-facing functionality (price display, tier prices) is delivered transparently through the catalog pricing layer managed by Orangecat_Prices.


DevOps & Integrator Notes

Deployment Checklist

Integration Token Scope

Minimum ACL permission required for API access: Orangecat_PricesCompany::manage (under Magento_Catalog::catalog). The /calculate endpoint is anonymous and does not require a token, but should be protected at the API gateway level in production if price data is sensitive.

Disabling Without Uninstalling

When disabled, the PricesCompanyCalculator is still registered in the DI graph but Config::isEnabled() returns false, causing calculate() and getTiers() to return early without touching the database. No pricing rules are lost.

Data Integrity Notes


All versions of module-prices-company with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
magento/framework Version *
orangecat/core Version *
orangecat/module-company Version *
orangecat/module-prices Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package orangecat/module-prices-company contains the following files

Loading the files please wait ...