Overview
Code: kv_announcement_bars · Version: 1.0.0 · Works with: OpenCart 4.x and 3.0.x
The bar at the top of a store is the first thing every visitor reads. Announcement Bars puts the right message there for each visitor: a sale with a coupon and a countdown that matches the coupon, how much more the cart needs for free shipping, or a calm notice at the bottom of the screen. On any theme.
- Top or bottom: a bar above the header, or fixed at the bottom of the screen. One bar per position, the highest priority wins.
- Rotating messages: up to 10, with a link each. Hovering pauses them; arrows and swipe change them.
- Real coupon:
{coupon} shows the code of an OpenCart coupon, copied with one tap; {discount} shows 10% or $5.00. While the coupon cannot be used (switched off, outside its dates, used up), those messages are left out. - Countdown:
{countdown} counts to the end of the coupon (the same moment OpenCart stops taking it) or to the end of the bar. At zero the bar goes. - Free shipping meter:
{free_left} shows what the cart still needs, from your amount or the Free Shipping extension. Amount and meter update after an add to cart, without a reload. When the cart qualifies, your thank-you text replaces it. - Schedule: start and end. The browser checks the dates too, so a cached page never shows a finished offer.
- Targeting: pages and routes, guests or signed-in customers, customer groups, countries and stores.
- Closable: a closed bar stays closed for 30 days, or until you save it again.
| Page | Contents |
|---|
| Installation | Requirements, installing, first steps, updating, removing |
| Configuration | Settings, country source, license |
| Usage | Making a bar, placeholders, targeting, what shoppers see |
| FAQ | Common questions |
Tested on
| |
|---|
| OpenCart | 4.1.0.4 and 3.0.5.1 |
| PHP | 8.3 with OpenCart 4.1.0.4, 8.1 with OpenCart 3.0.5.1 |
| Themes | The default themes of both versions, and our Atlas and Pulse themes |
Limits of this version
- Messages are plain text with placeholders; no images or HTML.
- One text per message, shown as you wrote it.
- The visitor country comes from a CDN header (for example Cloudflare) or from the customer's address. Without either, country-targeted bars stay hidden for that visitor unless you change the setting.
- The free-shipping amount follows the cart subtotal, the same figure the Free Shipping extension uses. Geo zones of that extension are not checked.
- The live update after an add to cart works with the jQuery requests of OpenCart and most themes. A theme with its own cart code updates the amount on the next page.
Installation
Requirements
- OpenCart 4.0.2.0 to 4.1.x, or 3.0.3.8 to 3.0.5.x
- PHP 7.4 or newer
Install on OpenCart 4
- Go to Extensions > Installer and upload
kv_announcement_bars.ocmod.zip. - Press the install button next to Announcement Bars.
- Go to Extensions > Extensions, choose Modules and install Announcement Bars.
Install on OpenCart 3
- Go to Extensions > Installer and upload
kv_announcement_bars-oc3.ocmod.zip. - Go to Extensions > Modifications and press Refresh.
- Go to Extensions > Extensions, choose Modules and install Announcement Bars.
First steps
- Open Marketing > Announcement Bars.
- Pick a template: Free shipping meter, Sale with a coupon or Store notice. Or start blank.
- Write your messages, check the preview and save. The bar shows on the storefront right away.
Updating
Upload the new package the same way. Bars and settings stay; the extension brings its tables up to date by itself the next time you open it.
Removing
Uninstalling removes the bars and the settings. Your coupons and orders are not touched.
Configuration
Open Marketing > Announcement Bars > Settings.
| Setting | What it does |
|---|
| Status | Shows or hides every bar on the storefront, without changing them. |
| Country from a CDN header | Reads the visitor country from Cloudflare (CF-IPCountry), CloudFront and similar headers. The page tells you whether your store receives one. |
| Unknown country | Off (default): a bar for some countries stays hidden when the country is unknown. On: it shows. |
Where the country comes from
- A CDN header, when the setting is on and the header is there.
- The address of a signed-in customer.
- The address entered during checkout.
Without any of these the country is unknown.
Free shipping amount
Each bar can have its own amount. Empty means the amount of the OpenCart Free Shipping extension when it is enabled. The amount is in your default currency; shoppers see it in theirs.
License
Enter your key on the Settings page. The 14-day trial runs without a key. When a license is not valid, bars are hidden on the storefront. The admin stays open and your bars stay.
Usage
Making a bar
Open Marketing > Announcement Bars and pick a template or New bar.
| Section | What you set |
|---|
| Bar | Name (only you see it), on or off, top or bottom, priority |
| Messages | Up to 10 messages with an optional link each, seconds per message, close button |
| Offer | Coupon, countdown, free shipping amount and the text once the cart qualifies |
| Look | Background, text and accent colours, or one of eight colour sets |
| Schedule | Start and end, in store time |
| Who sees it | Pages, routes, guests or customers, customer groups, countries, stores |
The preview at the top follows every change.
Placeholders
| Placeholder | Shows | Message left out when |
|---|
{coupon} | The coupon code; one tap copies it | The coupon is off, outside its dates or used up |
{discount} | 10%, $5.00 or Free shipping | Same as above |
{countdown} | Days, hours, minutes, seconds | The countdown target has passed |
{free_left} | What the cart still needs for free shipping | No amount is set; or the cart qualifies and there is no thank-you text |
Example: Weekend sale: {discount} off with {coupon} and Sale ends in {countdown}.
OpenCart ends a coupon at 00:00 of its end date. The countdown uses the same moment, so it never promises more time than the cart gives.
Pages and routes
Tick All pages or the page types. More pages by route takes OpenCart routes such as information/contact; end with * for everything below, as in account/*.
Several bars
Each position shows one bar. When several fit a visitor, the highest priority wins. When a visitor closes it, the next one shows.
What shoppers see
- The top bar sits above the header. The bottom bar is fixed at the bottom of the screen and keeps a theme's own bottom tab bar visible.
- Messages rotate, pause on hover, and change with the arrows or a swipe.
- The free-shipping amount and its meter update after an add to cart.
- Printing hides the bars.
FAQ
Does it create discounts?
No. It shows your OpenCart coupons. Make the coupon in Marketing > Coupons, then pick it in the bar.
What happens when the coupon is used up?
Messages with the code or the discount are left out at once. With a countdown to the coupon, the whole bar goes.
My store uses a page cache. Will an old bar show?
The browser checks the start and end dates and closed bars again, so a finished offer does not show from a cached page.
Can I show a bar only in some countries?
Yes. The country comes from a CDN header such as Cloudflare, or from the customer's address. See Configuration.
Does it work with my theme?
The bars are placed right after the opening body tag and before the closing one, which every theme has. Tested on the default themes and on our Atlas and Pulse themes.
Does it slow the store down?
No outside requests. The bar is part of the page; the only extra request is the free-shipping update after an add to cart.
Do you edit core files?
No. It uses events only, without OCMOD.