chrismallory/module-promobanner
This Magento 2 module adds the ability to display a simple promotional banner throughout your website. It also includes the ability to customize the styles of the promotional banner.
- Install the module composer by running
composer require chrismallory/module-promobanner
- Enable the module by running
php bin/magento module:enable ChrisMallory_PromoBanner
- apply database updates by running
php bin/magento setup:upgrade
- Flush the cache by running
php bin/magento cache:flush
- Clone or unzip this repository to
app/code/ChrisMallory
- Enable the module by running
php bin/magento module:enable ChrisMallory_PromoBanner
- Apply database updates by running
php bin/magento setup:upgrade
- Flush the cache by running
php bin/magento cache:flush
This module adds a new section in the general tab of your store's configuration.
To access this module's configuration, navigate to Stores > Settings > Configuration
In the configuration menu click on Header under the General tab.
The Promotional Banner settings will now be displayed. Make your desired changes then click save.
This setting will enable or disable the display of the banner. By default, the banner is disabled.
Here you will enter the text shown on the banner. This field is required to be filled out when the banner is enabled. Otherwise, the banner will just display a bar along the bottom of the site header. There is no default for this setting.
This message will wrap on the frontend when the view is smaller so be careful to not make the message too long so that it doesn't take up too much real estate on mobile.
When filled out, the link entered here will be used when a user clicks on the banner. If no link is provided, the banner will not be clickable. There is no default for this setting.
When set to "Yes" you will be able to change the styles used in the banner to better fit your store or promotion. When this is set to "No" the default styles will be used. By default, this is set to no.
Here you can enter your preferred banner background color by either using the dropdown color picker that is activated when this field is active or by entering a valid CSS color value. This field will also accept all valid inputs for the CSS background property to allow for more advanced backgrounds like gradients, opacity, or even images. This setting defaults to #e22626 if not entered and is only shown when the use custom styles setting is set to "Yes".
Color Picker
Enter the font size you'd like your banners message to be. This field will also accept all valid inputs for the CSS font-size property. This setting defaults to 16px if not entered and is only shown when the use custom styles setting is set to "Yes".
Here you can enter your preferred banner message font color by either using the dropdown color picker that is activated when this field is active or by entering a valid CSS color value. This field will also accept all valid inputs for the CSS color property to allow for more advanced colors such as gradients and opacity. This setting defaults to #ffffff if not entered and is only shown when the use custom styles setting is set to "Yes".
Color Picker
The font weight sets how thick or thin characters in text should be displayed. This can be set between 100 and 900 by the hundreds (100, 200, 300, 400, etc). This field will also accept all valid inputs for the CSS font-weight property. This setting defaults to 600 if not entered and is only shown when the use custom styles setting is set to "Yes".
Not all font weights are supported by all fonts
This module has been tested and validated to work on Magento versions 2.3 and higher.
This module uses a ViewModel and should be compatible with versions 2.2 and higher but has not been tested on versions lower than 2.3.
If you find a bug or issue please create a new issue here and include as much detail and context as possible including screenshots.
This module is licensed under the Open Software License V3.0 which you can refer to here.