magenerds / baseprice

magenerds/baseprice

This module displays base prices

magento2-module Compatibility: 2.4.7-2.4.9 Code Quality: Fail Tests: N/A Security: Pass OSL-3.0

Are you the maintainer of magenerds?

Packagento pulls magenerds's Composer packages from the public registry so buyers can find them here.

Claim the namespace to take ownership, publish new releases directly, and start charging for premium versions.

Claim this namespace →

Magenerds_BasePrice

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.

[image: 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.

[image: 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.

[image: 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.

[image: BasePrice-Usage]

No changelog yet

The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.

Versions
Version Stability QA Status Compatibility Released
2.1.0 stable Fail Magento 2.4.7-2.4.9 Details 2020-11-10 09:59:44
2.0.0 stable Not tested Not yet tested Details 2018-12-11 11:12:18
1.3.0 stable Not tested Not yet tested Details 2018-09-23 20:17:35
1.2.3 stable Not tested Not yet tested Details 2018-08-31 11:33:14
1.2.2 stable Not tested Not yet tested Details 2018-05-06 14:58:21
1.2.1 stable Not tested Not yet tested Details 2018-02-08 10:45:52
1.2.0 stable Not tested Not yet tested Details 2018-02-07 13:04:27
1.1.1 stable Not tested Not yet tested Details 2017-11-19 14:15:33
1.1.0 stable Not tested Not yet tested Details 2017-05-08 19:47:35
1.0.9 stable Not tested Not yet tested Details 2017-03-20 18:57:42
1.0.8 stable Not tested Not yet tested Details 2017-03-16 11:51:50
1.0.7 stable Not tested Not yet tested Details 2017-03-16 09:10:24
1.0.6 stable Not tested Not yet tested Details 2017-02-17 18:58:32
1.0.5 stable Not tested Not yet tested Details 2017-02-14 13:24:33
1.0.4 stable Not tested Not yet tested Details 2017-01-15 11:06:50
1.0.3 stable Not tested Not yet tested Details 2016-12-30 17:50:24

Requires 2

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

Compatibility

Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.

Compatibility matrix (Magento × PHP)
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. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge. 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.

Static analysis results
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's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases.

PHPStan results by Magento and PHP version
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 for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.

Unit tests

Unit tests results by Magento and PHP version
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

Integration tests results by Magento and PHP version
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

Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.

Security results
Tool Status Findings Summary
Composer audit Pass 0
Malware scan Pass 0
License
OSL-3.0

More from magenerds

View vendor
Make it pay

Turn an existing module into recurring revenue.

If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.