# magenerds/baseprice

> This module displays base prices

`composer require magenerds/baseprice`

Canonical URL: https://packagento.com/magenerds/baseprice

## At a glance

- **Vendor**: magenerds (https://packagento.com/magenerds.md)
- **Latest version**: 2.1.0 — released 2020-11-10
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/magenerds/baseprice and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require magenerds/baseprice:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

This module displays base prices

## README

With this extension you can show the base price of volume products to your customers.   
If you have products which you sell in amounts and units this extension can calculate the base price.   
The extension installs the following basic units and its conversions:
* kg
* g
* mg
* l
* ml
* m
* cm
* mm

You can also extend the units and edit all conversions. Furthermore the display of the base price is editable. This extension also works for configurable products if you provide the necessary information for the configurable’s simple products.

### Extension installation
The easiest way to install the Magenerds module is via composer
```
## add to composer require
composer require magenerds/baseprice

## run magento setup to activate the module
bin/magento set:up
```

### Extension activation
At any time you can enable and disable this extension in the system configuration.   
You can do this by opening the backend menu ```Stores > Configuration```.   
There you will find the entry ```Magenerds > Base Price```.   
After clicking on it you see a dropdown box where you can enable/disable the module. Save the configuration and delete the cache.

![BasePrice-Activation](_images/bp_activation.png?raw=true "BasePrice Activation")

### Extension configuration
The extension can be configured if you go to ```Stores > Configuration``` and afterwards to ```Magenerds > Base Price```.   
After enabling the extension you can edit the base price template in order to influence the base price rendering in the frontend. You can type in whatever you want.   
There are three variables available to render the base price information:
* {BASE_PRICE}: Renders the calculated base price
* {REF_AMOUNT}: Renders the reference amount
* {REF_UNIT}: Renders the reference unit

**Example**: {BASE__PRICE} / {REF__AMOUNT} {REF__UNIT} will render to 2.90€ / 10 kg in the frontend.

![BasePrice-Template](_images/bp_config_1.png?raw=true "BasePrice Template")

The extension install basic units and its conversions. But you can edit these conversions, delete the units or extend it with further units and its conversions.   
Just click on Add below all those conversions in order to add another unit row. You define the product unit on the left side and the reference unit (the unit which the price will be calculated to) on the right side.

![BasePrice-Mapping](_images/bp_config_2.png?raw=true "BasePrice Mapping")

### How to use
Every product needs detailed information about the base price calculation. There are four attributes which every product has:
* Product amount: Select the amount the product gets selled with quantity 1
* Product unit: Select the unit the product gets selled with
* Reference amount: Select the reference amount the product price has to be calculated with
* Reference unit: Select the reference unit the product price has to be calculated with

**Example**: You have a product which is a bottle of milk which is 100 ml of size. It costs 2 €.   
You want to display the price of milk for 1 l which is 20 €.   
Therefore you have to configure your product like the following:
* Product amount: 100
* Product unit: ml
* Reference amount: 1
* Reference unit: l

You can configure the attributes in a product edit mask under the tab Base Price on the left side.

![BasePrice-Usage](_images/bp_use.png?raw=true "BasePrice Usage")

## Recent Versions

| Version | Released |
|---|---|
| 2.1.0 | 2020-11-10 |
| 2.0.0 | 2018-12-11 |
| 1.3.0 | 2018-09-23 |
| 1.2.3 | 2018-08-31 |
| 1.2.2 | 2018-05-06 |
| 1.2.1 | 2018-02-08 |
| 1.2.0 | 2018-02-07 |
| 1.1.1 | 2017-11-19 |
| 1.1.0 | 2017-05-08 |
| 1.0.9 | 2017-03-20 |

Showing 10 of 16 versions. Full release history on https://packagento.com/magenerds/baseprice.

## Dependencies

### Require

| Package | Constraint |
|---|---|
| magenerds/dashboard | ^1.0 |
| magento/framework | ^100.0.0\|^101.0.0\|^102.0.0\|^103.0.0 |

## Quality

Latest release (2.1.0) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | Pass |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Fail | 88 | 3 errors, 85 warnings (ruleset: Magento2) — 69 auto-fixable with phpcbf |
| PHPMD | Warning | 3 | 3 rule violations (UnusedFormalParameter:1, ExcessiveMethodLength:1, UnusedLocalVariable:1) |
| Cpd | Pass | 0 |  |
| Composer validate | Pass | 0 |  |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 1 | 1 | – | – |
| 2.4.8 | – | 1 | 1 | – |
| 2.4.9 | – | – | 1 | 1 |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["magenerds/baseprice"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

magenerds is a Magento 2 vendor on Packagento. See https://packagento.com/magenerds.md for their full catalogue.

