Skip to content

Releases: ROLLPIX/M2-Discount-labels

v1.2.1 - Bugfix + Page Builder Support

Choose a tag to compare

@nmarquev nmarquev released this 26 Feb 06:05

Fixes

  • Critical fix: Resolved TypeError: Cannot read properties of undefined (reading 'indexOf') in badge-renderer.js — caused by styles.position being undefined when config values from previous versions weren't migrated to the new paths
  • PHP Config: Position now falls back to after_old_price_inline if the stored value is empty/null
  • JS Renderer: Defensive checks for undefined styles, position, and badgeStyle throughout the rendering pipeline
  • FPC Compatibility: setConfig() now ensures pdpStyles and listingStyles exist even when Full Page Cache serves HTML from older module versions

New

  • Page Builder Support: Added MutationObserver in the initializer to detect priceBox elements added dynamically to the DOM — covers Page Builder product widgets (grid, carousel), AJAX-loaded content, and lazy-loaded blocks

Update

composer require rollpix/module-discount-badge:1.2.1
bin/magento setup:upgrade
bin/magento cache:flush

For static content in production mode:

bin/magento setup:static-content:deploy -f

v1.2.0

Choose a tag to compare

@nmarquev nmarquev released this 26 Feb 05:56

Changes

  • 4 position options near old price: inline (same line) and block (new line) for both before/after
  • Backward compatibility: Legacy values from v1.0.0 (after_old_price) and v1.1.0 (right_of_old_price) are automatically mapped — no manual config reset needed on upgrade
  • Block position CSS: New .rollpix-discount-badge--block class for new-line display

Position options

Value Description
After old price — same line Inline-flex, badge right of strikethrough price
After old price — new line Badge on its own line below strikethrough price
Before old price — same line Inline-flex, badge left of strikethrough price
Before old price — new line Badge on its own line above strikethrough price
Over image (4 corners) Absolute positioned over product image
Below price block Below the entire price block

Upgrade

composer require rollpix/module-discount-badge:1.2.0
bin/magento cache:flush

No need to re-select position in admin — old values are auto-mapped.

v1.1.0

Choose a tag to compare

@nmarquev nmarquev released this 26 Feb 05:50

Changes

  • Independent badge position: PDP and Listing now have separate position settings
  • Inline flex fix: Badge renders on the same line as the old price (inline-flex wrapper)
  • Renamed positions: right_of_old_price / left_of_old_price for clarity
  • Composer install: README now includes composer config repositories step

Upgrade note

If upgrading from v1.0.0, re-select the badge position in admin for both PDP and Listing groups (the old after_old_price value is no longer valid).

v1.0.0 - Rollpix Discount Badge

Choose a tag to compare

@nmarquev nmarquev released this 26 Feb 05:19

Rollpix_DiscountBadge v1.0.0

Dynamic discount percentage badge for Magento 2 product prices.

Features

  • Calculates discount % from regular_price vs final_price
  • Displays badge in all price contexts: category, PDP, search, widgets
  • Updates dynamically on configurable product option changes
  • 5 visual styles: Filled, Outline, Pill, Pill Outline, Text Only
  • 7 position options: inline with price, over product image, below price
  • Independent styling for PDP and listing contexts
  • Custom CSS field for per-store overrides
  • Configurable minimum discount threshold
  • Translatable text template per Store View
  • FPC & Varnish compatible — 100% client-side JS

Compatibility

  • Magento 2.4.7 ~ 2.4.8
  • PHP 8.1 ~ 8.3

Installation

composer require rollpix/module-discount-badge
bin/magento module:enable Rollpix_DiscountBadge
bin/magento setup:upgrade
bin/magento cache:flush

Configuration

Stores > Configuration > Rollpix > Discount Badge