Download the PHP package majistar/module-product-labels without Composer

On this page you can find all versions of the php package majistar/module-product-labels. 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-product-labels

Majistar Product Labels for Magento 2 and Mage-OS

Magento Mage-OS Hyvä PHP

Badges such as "Sale -20%", "New" or "Best seller" on top of product images. A label is a short text or an image of your own. It is assigned by rules (categories, attributes, price, discount, stock, news dates) or by hand, and it shows up on the product page, in category and search listings, in the cart, the mini-cart and the checkout summary. The storefront part is written for Hyvä.

The screenshots come from a test store with the Luma sample catalog, set to show one label per product.

Contents

Features

Requirements

Installation

If the package is not on Packagist yet, add the repository first:

The module adds its templates to the Tailwind build of your Hyvä theme. Regenerate the Hyvä configuration and rebuild the theme styles:

In production mode, finish with bin/magento setup:di:compile and bin/magento setup:static-content:deploy. Without Composer, copy the files to app/code/Majistar/ProductLabels and run the same commands from module:enable on.

Configuration

Stores > Configuration > Catalog > Catalog > Product Labels

Setting Default What it does
Enabled Yes Turns the labels off on the storefront without touching them.
Max Labels per Product 2 Extra labels are dropped, lowest priority first.
"New" Means "Set Product as New" dates What the "Only New Products" filter looks at: the "Set Product as New" dates, or the days since the product was created.
New for (Days) 30 Used with "days since the product was created".
Out of Stock Products Show Only Out-of-Stock Labels Yes An out-of-stock product only shows labels whose stock filter is "Out of stock".

Creating a label

Labels live under Catalog > Inventory > Product Labels.

General. The name is only for the admin. Store views, customer groups and the active dates decide where and when the label applies. Lower priorities are shown first; "Stop Further Labels" hides the labels that come after this one. "Show On" picks the places: product page, product listings (categories, search, widgets, related products), shopping cart page, mini-cart and checkout.

Screenshot: General ![General section](docs/images/admin-label-general.png)

Appearance on Product Page. Text or image, colors, shape, size, corner radius and position. The variable menu inserts {SAVE_PERCENT} and the other variables into the text.

Appearance in Product Listings and Appearance in Cart, Mini-cart and Checkout reuse the previous appearance until you switch them to their own, for example a smaller text for the cart thumbnails.

Which Products. Quick filters: only new products, only products on sale (optionally with a minimum discount), stock, categories and a price range. All the filters you set must match.

Advanced Conditions. The condition builder of Catalog Price Rules, for example "Eco Collection is Yes".

Manually Assigned Products. Labels can also be given by hand on the product edit page, in the Product Labels section. A label assigned by hand is shown even when the product doesn't match its filters and conditions; the active dates, store views, customer groups and "Show On" still apply.

Configurable products

A configurable product and each of its variants are separate products, and each can match a label on its own.

Use for Parent. When a variant matches a label with this option on, its configurable product gets the label too.

Following the variant. On the product page, and in listings that show swatches, the badges change with the customer's choice. While the selection is incomplete, the badges of the configurable product are shown. Once every option is chosen, the badges of that variant replace them, and a variant without labels shows none. Below, the hoodie itself has the "Eco" label, its black variants have "Color of the month" and the gray ones have no label.

On the storefront

Place Where the badges go
Product page Over the main image, through Hyvä's gallery.additional container.
Category, search, widgets, related products Over the image of each product card. A plugin wraps the card image; Hyvä's item.phtml is not copied.
Shopping cart page Over the item thumbnail, the same way.
Mini-cart Over the item image of the cart drawer. Hyvä has no slot there, so the module ships a copy of Magento_Theme::html/cart/cart-drawer.phtml with the badges added (search for Majistar_ProductLabels in the file).
Checkout In the order summary of checkouts that dispatch the majistar_checkout_summary_item event (Majistar_Checkout). Hyvä Checkout and the Luma checkout are not supported yet.

Indexing and caching

Which products match which label is kept in the majistar_product_labels index. It follows label, product, category and manual assignment changes on save ("Update on Save") or by cron ("Update by Schedule"). A full rebuild:

Moving a category, changing its "Anchor" setting or adding a store view marks the index as invalid; reindex afterwards (cron does it in "Update by Schedule" mode).

Prices, discounts, stock, "new" dates and the customer group are checked when the page is rendered and need no reindex. Pages carry the majistar_product_label cache tag, so saving or deleting a label refreshes the full page cache and the cached product cards. Changes that only depend on time, such as an "active to" date passing, appear when the cached page expires.

REST API

All routes require the ACL resource Majistar_ProductLabels::labels.

Method Route Does
GET /V1/majistar-product-labels/:labelId Returns a label.
GET /V1/majistar-product-labels/search?searchCriteria[...] Searches labels.
POST /V1/majistar-product-labels Creates a label.
PUT /V1/majistar-product-labels/:labelId Updates a label; only the fields you send change.
DELETE /V1/majistar-product-labels/:labelId Deletes a label.
GET /V1/majistar-product-labels/products/:productId Ids of the labels assigned to a product by hand.
PUT /V1/majistar-product-labels/products Replaces them: {"productId": 10, "labelIds": [3, 5]}.

Creating a label that shows the discount on every product on sale:

Leave out listing_appearance or cart_appearance to reuse the previous appearance. Accepted values: show_on product listing cart minicart checkout; shape rectangle pill circle; text_size s m l; position top-left top-center top-right middle-left center middle-right bottom-left bottom-center bottom-right; stock_status any in_stock out_of_stock low_stock; corner_radius 0-50. conditions_serialized takes the JSON of Catalog Price Rule conditions.

Images. Send the file as base64 in image_content. It must be a JPG, PNG, GIF, WebP or AVIF image of at most 2 MB; it is stored in pub/media/majistar_product_labels/ and its name is returned in image. To reuse an image that is already there, send its name in image.

Products. GET /V1/products/:sku and the product search return the labels assigned by hand in extension_attributes.majistar_product_labels. Saving a product with that field replaces them; without it they are left alone.

Bulk. Every route is also available through Magento's /async/V1/... and /async/bulk/V1/... endpoints, for example POST /rest/async/bulk/V1/majistar-product-labels with an array of {"label": {...}}. The async.operations.all consumer processes the requests, and GET /V1/bulk/:bulkUuid/status reports the result.

Extending

Everything can be changed from another module, without editing this one.

Development

The repository ships the coding standard (phpcs.xml.dist) and the unit test configuration (phpunit.xml.dist). Run them from the module directory with the tools of a Magento or Mage-OS installation:

phpcs uses the Magento coding standard (magento/magento-coding-standard, part of Magento's dev dependencies); the unit tests use Magento's unit test framework found in MAGENTO_ROOT.

Uninstalling

The data stays in the database. To remove it, drop the majistar_product_label* tables and the indexer changelog table majistar_product_labels_cl, and delete pub/media/majistar_product_labels/.

License

Copyright © 2026 Majistar. Licensed under the Open Software License 3.0 (OSL-3.0), the same license as Magento Open Source and Mage-OS. See COPYING.txt.

Third-party code

view/frontend/templates/cart/cart-drawer.phtml is a modified copy of the cart drawer template of the Hyvä default theme (Magento_Theme::html/cart/cart-drawer.phtml, version 1.5.2), copyright © Hyvä Themes, which Hyvä Themes distributes under both the OSL 3.0 and the AFL 3.0; it is used here under the OSL 3.0. The changes add the product badges to each cart item.


All versions of module-product-labels with dependencies

PHP Build Version
Package 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 majistar/module-product-labels contains the following files

Loading the files please wait ...