Repository navigation
Releases
OpenLabel 1.1.1
Docs-only release: the README now opens with an animated tour of OpenLabel on a Hyvä store: twenty labels in twenty built-in designs (corner, ribbon, circle, pill, outline; on the image and next to the price) on a category page, a tooltip on hover and the same labels on the product page.
No code changes from 1.1.0. The GIF lives in docs/assets, which the Composer package leaves out.
Upgrade: composer update iranimij/openlabel-hyva-bundle (nothing else to run). Full list: CHANGELOG.md.
OpenLabel 1.1.0
OpenLabel 1.1 for Magento 2 and Hyvä: labels in more places, more ways to show them, and an API to manage them.
Highlights:
- More places: shopping cart, mini cart, wish list, compare page and order, invoice, shipment and credit memo emails; "hide labels on these pages".
- 21 positions on and around the product image, plus next to the price, next to Add to Cart and under the name.
- Tooltips and click-through links (CSS only), labels that follow the chosen variant and a live countdown.
- Conditions: bestseller, most viewed, ships free. Variables:
{CATEGORY_NAME},{BRAND}, and "hide when a variable is zero". - Designs: 31 built-in designs, sizes per phone/tablet/desktop, entry animation and hover effect, global CSS, AVIF images.
- Admin: an OpenLabel section on the product edit page with the labels a product shows, and labels assigned by hand.
- REST API for labels and designs. Label packs in English, German, French, Spanish, Dutch and Italian.
- README: a line-by-line comparison with Amasty and Mirasvit Product Labels (from their public documentation).
Upgrade: composer update iranimij/openlabel-hyva-bundle, bin/magento setup:upgrade, bin/magento openlabel:reindex. New tables and columns are added by setup:upgrade; export files from 1.0 still import.
API: new methods on Api\Data interfaces (see CHANGELOG "Changed"); code that only uses them is unaffected, classes that implement them must add the methods.
Tested on Magento 2.4.7, 2.4.8 and 2.4.9 with PHP 8.2–8.4, Hyvä 1.4.2 and 1.5.2 (Playwright, CSP enforced, Varnish on). Full list: CHANGELOG.md.
OpenLabel 1.1.0-rc1
Release candidate for OpenLabel 1.1.0.
OpenLabel 1.1 for Magento 2 and Hyvä: labels in more places, more ways to show them, and an API to manage them.
Highlights:
- More places: shopping cart, mini cart, wish list, compare page and order, invoice, shipment and credit memo emails; "hide labels on these pages".
- 21 positions on and around the product image, plus next to the price, next to Add to Cart and under the name.
- Tooltips and click-through links (CSS only), labels that follow the chosen variant and a live countdown.
- Conditions: bestseller, most viewed, ships free. Variables:
{CATEGORY_NAME},{BRAND}, and "hide when a variable is zero". - Designs: 31 built-in designs, sizes per phone/tablet/desktop, entry animation and hover effect, global CSS, AVIF images.
- Admin: an OpenLabel section on the product edit page with the labels a product shows, and labels assigned by hand.
- REST API for labels and designs. Label packs in English, German, French, Spanish, Dutch and Italian.
- README: a line-by-line comparison with Amasty and Mirasvit Product Labels (from their public documentation).
Upgrade: composer update iranimij/openlabel-hyva-bundle, bin/magento setup:upgrade, bin/magento openlabel:reindex. New tables and columns are added by setup:upgrade; export files from 1.0 still import.
API: new methods on Api\Data interfaces (see CHANGELOG "Changed"); code that only uses them is unaffected, classes that implement them must add the methods.
Tested on Magento 2.4.7, 2.4.8 and 2.4.9 with PHP 8.2–8.4, Hyvä 1.4.2 and 1.5.2 (Playwright, CSP enforced, Varnish on). Full list: CHANGELOG.md.
OpenLabel 1.0.0
OpenLabel 1.0: free, MIT-licensed product labels for Magento 2 and Hyvä.
Install the Hyvä bundle:
composer require iranimij/openlabel-hyva-bundle
bin/magento setup:upgrade
bin/magento openlabel:reindex
Supported: Magento Open Source, Mage-OS and Adobe Commerce 2.4.7–2.4.9, PHP 8.2–8.4, Hyvä 1.4 and 1.5 (1.3 best effort).
In 1.0:
- Engine: an indexer with conditions on sale, new, stock, price, rating, review count and any product attribute; 15 variables; labels per store view, customer group and time window.
- Admin: a label form with quick switches, a 3×3 position picker, live preview, matched products with "Why no products?", 15 built-in designs and starters.
- Storefront: server-side markup in the cached page, one generated stylesheet, no JavaScript, and no Tailwind build needed.
- Ops: GraphQL
openlabel_labels, the CLI (reindex, preview, export and import as JSON, Smile importer),var/log/openlabel.log.
Since rc2:
- Hyvä 1.5 product-page labels.
- Quick switches can be combined with advanced conditions (that combination used to fail to save).
- Every operator behaves the same on 2.4.7–2.4.9.
- Error logging.
- "Why no products?".
Details are in the CHANGELOG and the documentation.
v1.0.0-rc2
Fixed
- GraphQL
openlabel_labels: price variables ({SAVE_PERCENT},{SAVE_AMOUNT},{PRICE},{SPECIAL_PRICE},{FINAL_PRICE},{SPECIAL_ENDS_IN},{SPECIAL_END_DATE}) rendered empty inproductsqueries that did not ask for prices ("Sale -%"); asking foropenlabel_labelsnow loads the price attributes.
v1.0.0-rc1
Release candidate for 1.0.0. Install and quick start: https://github.com/iranimij/openlabel#readme
1.0.0 follows after the recorded real-person acceptance tests.
First release candidate of OpenLabel 1.0: engine (M1), admin (M2), Hyvä render (M3), GraphQL, export/import, Smile importer and documentation (M4). Everything in Api/ follows semantic versioning from 1.0.0. Supported: Magento 2.4.7–2.4.9, PHP 8.2–8.4, Hyvä 1.4 (1.3 best effort; on 1.5 listings work, product-page labels not yet).
Added
- M4 S6 · README for 1.0 (one-line pitch, the three install commands, a five-minute quick start, compatibility (Hyvä 1.4 tested; 1.3 best effort; 1.5 listings only, product gallery not yet), caching notes, support promise and Discussions); documentation site (
mkdocs.yml, built with--strictin CI, published to GitHub Pages on release tags) with new pages for installation/upgrade/uninstall and the CLI; draft Hyvä compatibility tracker entry (docs/tracker-entry.md);dev-mainis aliased1.0.x-dev. - M4 S4 · German storefront translations (
i18n/de_DE.csv: day and hour units of {SPECIAL_ENDS_IN} and {NEW_FOR}); a unit test keepsen_US.csvcomplete. - M4 S3 ·
bin/magento openlabel:import-smile [--dry-run]copies the labels of the open-source Smile product label module (read straight from itssmile_productlabeltables; the module need not be installed): each becomes an image design and a label "attribute is option" with listing/product placements (top/lower left/right), store views and status; it goes through the regular importer (same checks, one transaction). Labels already imported (same name) are skipped, so it can run again; missing images and unknown positions are reported. - M4 S2 ·
bin/magento openlabel:export [file] [--labels=1,2]andopenlabel:import <file> [--dry-run] [--replace]: labels with their designs, store-view texts, conditions, placements and images (embedded) as one portable JSON file; store views and customer groups travel by code, built-in designs by name. Import is all or nothing: the whole file is checked against the shop first (codes, design references, condition classes, label and design rules, image validation with SVG sanitizing, custom CSS sanitizing), then written in one transaction and reindexed;--replaceupdates labels and designs with the same name. - M4 S1 · GraphQL:
openlabel_labelsonProductInterfacereturns the labels visible for the request's store view (Storeheader) and customer group (customer token), one entry per placement, as structured data (id name type text image_url alt position area css_class bg_color text_color priority;textis plain text with the variables filled in, never HTML). All products of a query are resolved with one label query (batch resolver); disabled, out-of-window and other groups' labels are never exposed, nor are conditions. Cached GET responses carryopenlabel_<id>andopenlabel_design_<id>tags, so label and design saves purge them. New core dependenciesmagento/module-graph-ql,magento/module-catalog-graph-ql,magento/module-customer-graph-ql. - M3 S2 · Storefront label markup:
ViewModel\LabelRenderer::getStacksHtml($product, $area, $loading)renders oneol-stackper occupied position withol-label ol-label--text|image|shape ol-d-<id> ol-shape-*badges (templatebase/stacks.phtml, no inline styles, logicalol-pos-*classes, physicalol-pos-tl|tr|ml|mr|bl|brfor placements that keep their side in RTL,ol-p-<id>for offsets and gap); image labels carry width, height, alt and the product image'sloading; variables rendered with only the review/sales preloads the page's texts need;data-ol-labelin debug mode.ViewModel\Labels::remember()resolves a whole collection with the first label lookup (one query per listing).Block\Css(the single<link>, generated on first use) andBlock\Identities(page cache tagsopenlabel_<label_id>andopenlabel_design_<design_id>). The generator accepts extra structural sources from theme packages (sourcesDI argument). - M3 S1 · Generated stylesheet: one file per store view at
pub/media/openlabel/<store_id>/openlabel.<hash>.csswith the structuralol-*CSS, one custom-property line per design (.ol-d-<id>), one per placement with offsets or gap (.ol-p-<id>) and the sanitized custom CSS; rebuilt after every design and label save, bybin/magento openlabel:css:regenerateand by the new "Regenerate CSS" button in the settings; generated on first use after a fresh install; previous files are kept two days for pages still in the page cache. - M2 S1 · 15 built-in designs (idempotent data patch; existing system designs are never overwritten, missing ones restored) and
Model\Design\Contrast(WCAG ratio and level). - M2 S2 · Admin menu Catalog › OpenLabel › Labels / Designs; labels grid (design preview, placements summary, matched product count, active-now filter, store views) with inline edit of name, status, priority and dates (shop timezone ↔ UTC) and mass enable/disable/delete; designs grid with mass delete that keeps built-in and in-use designs. New core dependency
magento/module-ui. - M2 S3 · Design form: Text/Image/Shape cards, colour pickers with a live contrast badge, variable picker and 24-character counter, per-store-view text, image upload with content-type check, size limits, SVG sanitizing and stored dimensions, custom CSS sanitizer behind
Iranimij_OpenLabel::custom_css; built-in designs locked with "Duplicate to edit". - M2 S4 · Label form: visual design picker, priority, hide other labels, apply to parents, store views, customer groups, schedule in the shop timezone, placement rows; Save, Save & Continue, Save & Duplicate (disabled copy), Delete; validation shown above the form without a reload.
- M2 S5 · "Show when": switches for On sale, New, Low stock, Out of stock and Well rated stored as built-in conditions next to the advanced rule tree (combined with AND).
- M2 S6 · "Show where": 3×3 position picker, per-page design override, max labels, stacking, gap, offsets, keep left/right in RTL.
- M2 S7 · Live preview panel (sample values, desktop/mobile, contrast warning, Preview as a customer group) and
view/base/web/css/openlabel.css, the structuralol-*stylesheet the storefront generator will reuse. - M2 S8 · Matched products section with the first 50 products and "Reindex now".
- M2 S9 · Empty-state starters (Sale, New, Low stock) and a feedback link.
- M2 S10 · Settings: default max labels per position, label indexer mode hint, debug mode;
docs/admin.md; coverage gate now also covers Model/Css and Model/Image. - M1 S1 · Engine data layer: declarative schema for
openlabel_label,openlabel_design,openlabel_design_store,openlabel_placement,openlabel_index(+ replica);Api/Datainterfaces for Label, Design (store-scoped text, alt text, tooltip) and Placement;LabelRepositoryInterfaceandDesignRepositoryInterface(placements and store texts are saved with their parent); validators with actionable messages; ACL resourcesIranimij_OpenLabel::openlabel,::labels,::designs,::custom_css; uninstall class. Index rows usecustomer_group_id = -1for "all groups". - M1 S2 · Rule engine:
Model\Rule\Rule(condition tree evaluated in SQL through the coreSql\Builder),CombineandProductconditions (native product attributes incl. store-scoped ones, via the catalog widget condition), built-in conditions On sale (on_sale, discount %, discount amount from the price index per website and customer group), Is new (news dates, days since created/updated), Stock (salable and salable quantity, MSI with legacy fallback), Price range (final/regular price), Rating (stars) and Review count, plus a DIConditionPoolfor custom conditions. - M1 S3 · Indexer
openlabel_product(mview, depends on price and stock indexers): full rebuild intoopenlabel_index_replicawith an atomic table swap and a lock, partial rebuilds for changed products and their configurable/grouped/bundle parents, one row per customer group for price labels, parent rows forapply_to_parentlabels, label reindex on save with cache cleaning bounded by the diff, plugins on the price, stock and review updates, hourly window-transition cron and daily is-new cron. - M1 S4 · Variables:
VariableProcessorInterface+ DIPoolwith {SAVE_PERCENT} {SAVE_AMOUNT} {PRICE} {SPECIAL_PRICE} {FINAL_PRICE} {STOCK_QTY} {NEW_FOR} {SKU} {ATTR:code} {BR} {SPECIAL_ENDS_IN} {SPECIAL_END_DATE} {RATING} {REVIEW_COUNT} {SOLD_LAST_30D};Rendererwith locale number, currency and date formatting, escaping and the HTML allow-list (b strong i em br span small sup sub);VariablePreloadInterfaceso review and sales data load once per listing; empty/zero variables are reported for the 1.1 hide flag. - M1 S5 ·
LabelResolverInterface(one SELECT per listing or product page over the index joined with labels, placements, designs and store texts; status, time window, customer group, hide-lower-priority and max-per-stack applied) returningResolvedLabelInterfaceDTOs, and theViewModel\Labels(memoized per request, customer group from the HTTP context, respects the enable switch). Labels limited to customer groups now index one row per allowed group even without price conditions. - M1 S6 · CLI:
openlabel:reindex [label_id](full rebuild through the indexer, or one label with its diff) andopenlabel:preview <label_id> [--store=<id>](matched count and the first 20 SKUs from the index). - M1 S7 ·
docs/engine.md; unit coverage gate in CI (≥ 85 % on Model/Variable, Model/Condition, Model/Resolver, Model/Rule); 2,000-product full-reindex budget test (main and nightly). - Module skeleton
Iranimij_OpenLabel(M0): system configuration sectionopenlabelunder the Iranimij tab withgeneral/enabled(default on), ACL resources, translations, CI template (PHPCS, PHPStan level 6, unit and integration matrix Magento 2.4.7/2.4.8/2.4.9 × PHP 8.2/8.3/8.4). - `do...