Download the PHP package rollpix/module-discount-badge without Composer

On this page you can find all versions of the php package rollpix/module-discount-badge. 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-discount-badge

Rollpix_DiscountBadge

Versión en español

SPONSOR: www.rollpix.com

Dynamic discount percentage badge for Magento 2 product prices. Displays a visual badge (e.g., 21% OFF) next to the strikethrough price wherever Magento renders prices with a discount.

Compatibility

Requirement Version
Magento 2.4.7 ~ 2.4.8
PHP 7.4 ~ 8.4

The module code is compatible with PHP 7.4 through 8.4. Actual deployable Magento/PHP combinations still depend on Adobe Commerce / Magento Open Source's official platform matrix.

Installation

Via Composer (recommended)

Manual installation

  1. Create the directory app/code/Rollpix/DiscountBadge/
  2. Copy all repository files there
  3. Run:

Admin Configuration

Navigate to Stores > Configuration > Rollpix > Discount Badge.

General Settings

Field Description Default
Enabled Enable/disable the badge globally No
Minimum Discount (%) Threshold to show badge (1-99) 5
Badge Text Template Text template with {discount} placeholder {discount}% OFF
Badge Position Where to place the badge (inline, over image, below price) After old price
Badge Style Visual variant: filled, outline, pill, pill_outline, text_only Filled

PDP & Listing Styles

Independent style settings for Product Detail Page and Product Listing contexts:

Custom CSS

Free-form CSS textarea injected in <head> for per-store overrides.

What It Does

Edge Cases

Behavior When Disabled

When the module is disabled in admin:

Technical Architecture

File Structure

How It Works

  1. PHP side: ViewModel/DiscountBadge.php reads admin config and outputs it as a x-magento-init JSON block
  2. JS init: discount-badge.js stores config and scans existing priceBox widgets
  3. Mixin: price-box-mixin.js hooks into reloadPrice() to update badges on price changes
  4. Renderer: badge-renderer.js handles calculation, DOM creation, and placement

Performance

CSS Classes

Class Description
.rollpix-discount-badge Base class
.rollpix-discount-badge--pdp Product detail page context
.rollpix-discount-badge--listing Listing context
.rollpix-discount-badge--inline Inline with price
.rollpix-discount-badge--over-image Over product image
.rollpix-discount-badge--below Below price block
.rollpix-discount-badge--filled Filled style
.rollpix-discount-badge--outline Outline style
.rollpix-discount-badge--pill Pill style
.rollpix-discount-badge--pill-outline Pill outline style
.rollpix-discount-badge--text-only Text only style

Manual Testing Guide

  1. Enable the module in Stores > Configuration > Rollpix > Discount Badge
  2. Create or find a product with a special price or catalog price rule
  3. Verify the badge appears on:
    • Category listing page
    • Product detail page
    • Search results
    • Related/upsell/crosssell widgets
  4. For a configurable product, change options and verify the badge updates
  5. Set minimum discount to a value above the product's discount and verify the badge disappears
  6. Test each position and style option
  7. Test custom CSS injection
  8. Disable the module and verify no badges appear

Uninstall

Via Composer

Manual

License

MIT


All versions of module-discount-badge with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4 <8.5
magento/framework Version *
magento/module-catalog Version *
magento/module-store 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 rollpix/module-discount-badge contains the following files

Loading the files please wait ...