Download the PHP package mage2kishan/module-notification-bar without Composer

On this page you can find all versions of the php package mage2kishan/module-notification-bar. 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-notification-bar

Magento 2 Notification Bar

Panth Notification Bar adds admin-managed announcement bars to a Magento 2 storefront. Each bar is a database record with its own content, position, colours, optional call-to-action button, optional countdown timer, schedule, store view, customer group, page and device rules, and dismissal behaviour. The module renders the qualifying bars in the after.body.start container on every frontend page, so nothing in the theme has to be edited.

It is used by store owners and marketing teams who want to publish promotions, shipping notices, cookie notices or similar messages from the admin panel. The single template uses plain JavaScript (no jQuery, Alpine.js, Knockout or RequireJS) and is used on both Hyva and Luma themes.

Product page: kishansavaliya.com/magento-2-notification-bar.html

Features

Compatibility

Platform Versions
Magento Open Source 2.4.4 to 2.4.8 (as published on the product page)
Adobe Commerce 2.4.4 to 2.4.8 (as published on the product page)
PHP ~8.1.0, ~8.2.0, ~8.3.0, ~8.4.0 (from composer.json)
Themes Hyva and Luma (one plain-JavaScript template is used for both)

Composer constraints on Magento packages: magento/framework ^103.0, magento/module-store ^101.1, magento/module-cms ^104.0, magento/module-customer ^103.0, magento/module-backend ^102.0, magento/module-ui ^101.2, magento/module-config ^101.2, magento/module-directory ^100.4.

Requirements

Installation

setup:di:compile is only required in production mode. The module ships no files under view/*/web, so no static content deployment is needed for it.

Check the result:

Configuration

Admin path: Stores > Configuration > Panth Extensions > Notification Bar. The section can be set at default, website and store view scope. It is also linked from the admin menu entry Notification Bar > Configuration.

General Settings

Setting Default What it does
Enable Notification Bar Yes Master switch. When set to No the frontend block is not rendered at all.
Max Visible Bars 3 Maximum number of bars rendered on one page. Qualifying bars are taken in sort order until this number is reached. If the value is 0 or empty the code falls back to 5.

Display Settings

Setting Default What it does
Default Position Top Fixed Used on the storefront when a bar has no valid position of its own. The bar form does not read this value.
Stack Multiple Bars Yes When No, only the first qualifying bar (lowest sort order) is shown. When Yes, bars are shown up to "Max Visible Bars".
Default Animation Slide Down Used on the storefront when a bar has no valid animation of its own.
Z-Index 40 CSS z-index of each bar. 0 or empty falls back to 40, which keeps bars below the sticky header (50), drawers (70) and modals (80).

Configuration paths:

Default behaviour after installation: the module is enabled, but no bars exist, so nothing is shown on the storefront until a bar is created (or the sample-data command is run).

Managing bars

Admin menu: Notification Bar > Manage Bars (added under the Panth_Core::panth_extensions menu group, admin route panth_notificationbar/bar/index). The grid lists ID, Name, Bar Type, Position, Active, Sort Order, Date From, Date To and Created At, with filters, column controls, bookmarks and mass actions Delete, Enable and Disable. The "Add New Bar" button opens the form, which has these fieldsets:

Multiselect values (Store Views, Customer Groups, Target Page Types, Target Countries) are stored as comma-separated lists in the database. "Bar Type" and "Target Countries" are stored and shown in the admin, but the storefront code in this version does not change styling based on the bar type and does not filter bars by the visitor's country.

Usage

Storefront output

The layout file view/frontend/layout/default.xml adds the block panth.notification.bar (template Panth_NotificationBar::notification-bar.phtml) to the after.body.start container on every page, before any other child of that container. The template outputs one <style> block, one <div class="panth-nbar ..."> per bar and one inline <script>; it returns nothing when the module is disabled or no bar qualifies.

For each page request the view model loads bars that are active and whose "To Date" is today or later (store view timezone), ordered by sort order, then drops any bar that fails one of these checks:

The inline script then checks each rendered bar in the browser, so the result stays correct on pages served from the full page cache:

Saving or deleting a bar in the admin cleans the full page cache entries that contain the notification bar block (cache tag panth_nbar).

Positions: top_fixed and bottom_fixed use position: fixed at the top or bottom of the viewport; top_static is rendered in the document flow; bottom_floating is fixed 20px from the bottom and sides with rounded corners and a shadow.

Countdown timer

Place {countdown} in the bar content and enable the countdown with an end date. The placeholder is replaced by a live counter (days, hours, minutes, seconds) updated every second in the browser; after the end date the label is hidden and the "Countdown Expired Text" is shown as plain text (Expired when the field was never set); when the field is empty the whole bar hides at the end date. The end date is entered in the configured store timezone, stored in UTC and sent to the browser as an ISO 8601 UTC value, so every visitor sees the same end moment. Without the placeholder no counter appears.

Call-to-action button

The button is rendered after the text when "Enable CTA Button" is Yes and "Button Text" is not empty. With "Open in New Tab" the link gets target="_blank" rel="noopener noreferrer". A button whose URL is # on a dismissible bar acts as a dismiss button (used by the sample "Cookie Consent" bar).

Dismissal

The close button writes the cookie panth_nbar_<bar_id>=dismissed for "Cookie Duration (Days)" days; with a duration of 0 the flag is written to sessionStorage instead. On later page loads the script hides a bar whose flag is present. "Auto-close After (Seconds)" dismisses the bar after that many seconds; on a dismissible bar this also stores the flag.

Console command

Inserts five sample bars into panth_notification_bar: "Welcome Promo Banner", "Free Shipping Notice", "Flash Sale Countdown" (countdown ending in three days), "Cookie Consent" and "Holiday Hours" (inactive). Running the command again inserts the rows again. Flush the cache afterwards to see the bars.

Overriding the template

Copy view/frontend/templates/notification-bar.phtml to app/design/frontend/<Vendor>/<theme>/Panth_NotificationBar/templates/notification-bar.phtml. The HTML of each bar is produced by ViewModel\NotificationBar::getBarHtml(), and the CSS uses the class names panth-nbar, panth-nbar-pos-<position>, panth-nbar-content, panth-nbar-icon, panth-nbar-text, panth-nbar-cta, panth-nbar-close, panth-nbar-countdown, panth-nbar-cd-label and panth-nbar-cd-unit. The font family can be set with the CSS custom property --panth-nbar-font.

There are no cron jobs, observers, plugins, web API endpoints or widgets in this module.

Developer Notes

Uninstallation

The table panth_notification_bar and the panth_notification_bar/* rows in core_config_data are not removed by these steps; drop or delete them manually if they are no longer needed. Panth_Core stays installed if other Panth modules use it.

Support

Documentation

USER_GUIDE.md covers the global settings, creating and editing bars, positions, stacking, countdown timers, targeting recipes, a per-bar option cheat sheet, CSS customisation and troubleshooting.

License

Commercial software license. See LICENSE.txt in this repository.

Changelog

See CHANGELOG.md.

Links

Bottom bar offset

While a bottom fixed or bottom floating bar is visible, the module sets the CSS variable --panth-bottom-bar-offset (the distance from the bottom of the viewport to the top of the highest bottom bar) and the class panth-has-bottom-bar on the root element. Floating buttons and toasts can add the variable to their bottom offset to stay above the bar; the WhatsApp and Live Activity modules do this. The page body gets the same bottom padding so its last controls can be scrolled clear of the bar, and bottom bars are not shown on the checkout or multishipping checkout pages.


All versions of module-notification-bar with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1.0||~8.2.0||~8.3.0||~8.4.0
magento/framework Version ^103.0
magento/module-store Version ^101.1
magento/module-cms Version ^104.0
magento/module-customer Version ^103.0
magento/module-backend Version ^102.0
magento/module-ui Version ^101.2
magento/module-config Version ^101.2
magento/module-directory Version ^100.4
mage2kishan/module-core Version ^1.0
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 mage2kishan/module-notification-bar contains the following files

Loading the files please wait ...