reach-digital / magento2-companyswitcher

reach-digital/magento2-companyswitcher

Moves the Company and Vat field to the top of the checkout and add a switcher (private/business).

magento2-module Compatibility: 2.4.7 Code Quality: Fail Tests: N/A Security: Pass BSD-2-Clause

Are you the maintainer of reach-digital?

Packagento pulls reach-digital'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 →

Reach Digital Company Switcher

Changelog

Installation

composer require reach-digital/magento2-companyswitcher
php bin/magento module:enable Ho_CompanySwitcher

Description

Moves the Company and Vat field to the top of the checkout and add a switcher (private/business).

'Own Reference' field

Field is added to the order view page automatically. You'll need to edit the matching template when adding the field to email/pdf.

Email

For email you can use:
{{depend order.getData('own_reference')}}<div>{{trans 'Own reference: %own_reference' own_reference=$order.getData('own_reference') |escape|raw}}</div>{{/depend}}

(Fooman) PDF

For PDF you can use:

<?php if (! empty($order->getData('own_reference'))): ?>
    <?= __('Own reference') ?>: <?= $block->escapeHtml($order->getData('own_reference')); ?><br/>
<?php endif; ?>

Configuring with OneStepCheckout.com extension

Onestepcheckout fields can randomly shift when using this extension without properly configuring the extension. You need to add the two new fields, and set them in the correct order. In the Onestepcheckout configuration add field with name 'company_switcher' and a field with the name 'own_reference'. Set the order of the fields:

  1. company_switcher (enable it!)
  2. company
  3. vat_id
  4. own_reference (you can disable it if you don't use it. But you need to add it)

Credits

Read more about this extension on our blog
https://www.reachdigital.nl/blog/gratis-magento-2-module-optimaal-zakelijk-bestellen-in-het-magento-afrekenproces

Developed by Reach Digital
https://www.reachdigital.nl

Change Log

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog
and this project adheres to Semantic Versioning.

[Unreleased]

[0.1.0] - 2016-12-29

Note

  • Created module
Versions
Version Stability QA Status Compatibility Released
0.5.0 stable Fail Magento 2.4.7 Details 2023-04-13 14:13:40
0.4.1 stable Not tested Not yet tested Details 2023-03-16 08:03:49
0.4.0 stable Not tested Not yet tested Details 2022-11-15 12:40:43
0.3.0 stable Not tested Not yet tested Details 2021-07-27 12:09:38
0.2.0 stable Not tested Not yet tested Details 2020-08-06 07:26:18
0.1.1 stable Not tested Not yet tested Details 2018-02-22 13:41:01
0.1 stable Not tested Not yet tested Details 2017-07-28 08:59:32

Requires 1

Package Constraint
php ^7.2|^7.3|^7.4|^8.0|^8.1

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 Fail di error
2.4.9 Fail di error Fail di error

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 6 3 errors, 3 warnings (ruleset: Magento2) — 3 auto-fixable with phpcbf
PHPMD Warning 2 2 rule violations (UnusedFormalParameter:2)
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 2 2
2.4.8 2 4
2.4.9 4 4

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

More from reach-digital

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.