Skip to main content

Updating Special Messages for Specific Stores (Multi Language Support)

This script allows you to update special store messages and labels.

Updated today

Updating Special Messages for Specific Stores

RP Promap Help Series


Overview

This guide explains how to update special messages for specific stores in your store locator script.

You will learn how to:

  • Modify day-specific messages (e.g., appointment-only days)

  • Display dynamic notices based on the current day

  • Customize header and section labels

  • Support any language, using Spanish as the working example

This setup is commonly used when different store locations require custom messaging rules.


Before You Start

Make sure you have:

  • Access to your store locator script

  • The correct location IDs for each store

  • A clear understanding of which days require special messaging

Example location IDs:

  • Acassuso → 18535034

  • Belgrano → 18535037


Getting Each Store’s Unique Location ID

To target a specific store, you must use its location ID. The easiest way to retrieve this is through the export function.

Step 1 — Export Your Locations

  1. Go to your store locator admin

  2. Use the Export or Download option

  3. Export your locations as a spreadsheet (CSV or Excel)


Step 2 — Find the Location ID Column

Open the exported file and look for a column labeled:

  • location_id

  • id

  • or similar identifier field

Each row represents a store, and this column contains the unique ID used in the script.


Step 3 — Match the Store to Its ID

Locate the store you want to update (by name, address, or city), then copy its ID.

Example:

Store Name

City

location_id

Acassuso

BA

18535034

Belgrano

BA

18535037


Step 4 — Use the ID in Your Script

Insert the ID into your selector:

[data-location-id="18535034"]

This ensures your message updates apply only to that specific store.


Notes

  • Always copy the ID exactly (no extra spaces)

  • IDs are unique — do not reuse between stores

  • If a store is not updating, double-check the ID from the export



How It Works

Each store is targeted using its unique location ID:

[data-location-id="18535034"]

Once targeted, the script:

  1. Updates day labels

  2. Adds appointment notices

  3. Adjusts header messaging

  4. Translates locator labels


Step 1 — Update Day-Specific Messages

The script checks the text of each day and replaces it when needed.

Example (Spanish)

if (text === 'Lunes') {   td.textContent = 'Lunes (solo con turno previo)'; }

Adapt for Any Language

You can replace the message with any language:

English

'Monday (appointment only)'

French

'Lundi (sur rendez-vous uniquement)'

Portuguese

'Segunda-feira (somente com agendamento)'

Step 2 — Control When Notices Appear

The script uses JavaScript’s day system:

  • 0 = Sunday

  • 1 = Monday

  • 2 = Tuesday

  • 3 = Wednesday

  • 4 = Thursday

  • 5 = Friday

  • 6 = Saturday

Example Logic

var message = (hoy === 1 || hoy === 6)   ? '⚠️ Hoy solo con turno previo'   : '';

This shows a message on Monday and Saturday only.

Custom Examples

Only Saturday

hoy === 6

Monday + Wednesday

hoy === 1 || hoy === 3

Every Day

var message = '⚠️ Hoy solo con turno previo';

Step 3 — Update the Notice Message

Default (Spanish example):

'⚠️ Hoy solo con turno previo'

Language Variations

English⚠️ Today by appointment only

German⚠️ Heute nur mit Termin

Italian⚠️ Oggi solo su appuntamento


Step 4 — Update Header Labels

The script updates default labels after load:

labels.forEach(el => el.textContent = 'Horarios'); phones.forEach(el => el.textContent = 'Teléfono'); distances.forEach(el => el.textContent = 'Distancia');

Example (English)

'Hours' 'Phone' 'Distance'

Best Practice — Support Any Language

To make your script scalable, centralize all text values.

Recommended Structure

var localeText = {   monday: 'Lunes',   saturday: 'Sábado',   mondayAppointment: 'Lunes (solo con turno previo)',   saturdayAppointment: 'Sábado (solo con turno previo)',   todayNotice: '⚠️ Hoy solo con turno previo',   hours: 'Horarios',   phone: 'Teléfono',   distance: 'Distancia' };

Why This Matters

  • Easier translation

  • Consistent messaging

  • Faster updates

  • Supports multiple regions


Multilingual Notes

1. Avoid Hardcoded Language Assumptions

The script currently checks exact values like Lunes and Sábado.

If the site language changes, these conditions may fail.


2. Handle Accents and Variations

Example already supported:

'Sabado' || 'Sábado'

Always account for:

  • accents

  • casing differences

  • encoding issues


3. Separate Logic from Language

Best structure:

  • Logic = when message shows

  • Language = what message says


Example Use Cases

Use this setup when:

  • Stores operate by appointment on certain days

  • Different regions require different languages

  • Certain locations need special notices

  • You want dynamic, day-based messaging


Copy Script (Production-Ready Template with Localization)

Below is a production-ready template designed for long-term maintenance. It includes:

  • centralized localization

  • per-store configuration

  • day-based logic

  • header and body notices

  • safer repeated updates for dynamic locator content

Spanish is used as the example language, but you can swap to any language by updating the localization object.

<script> (function () {   try {     var CONFIG = {       locale: 'es',       stores: [         {           id: '18535034',           key: 'acassuso',           restrictedDays: [1, 6],           dayTextRules: [             { match: ['Lunes'], replacementKey: 'mondayAppointmentOnly' },             { match: ['Sabado', 'Sábado'], replacementKey: 'saturdayAppointmentOnly' }           ]         },         {           id: '18535037',           key: 'belgrano',           restrictedDays: [6],           dayTextRules: [             { match: ['Sabado', 'Sábado'], replacementKey: 'saturdayAppointmentOnly' }           ]         }       ]     };      var LOCALES = {       es: {         labels: {           hours: 'Horarios',           phone: 'Teléfono',           distance: 'Distancia'         },         messages: {           todayAppointmentOnly: '⚠️ Hoy solo con turno previo',           mondayAppointmentOnly: 'Lunes (solo con turno previo)',           saturdayAppointmentOnly: 'Sábado (solo con turno previo)'         }       },       en: {         labels: {           hours: 'Hours',           phone: 'Phone',           distance: 'Distance'         },         messages: {           todayAppointmentOnly: '⚠️ Today by appointment only',           mondayAppointmentOnly: 'Monday (appointment only)',           saturdayAppointmentOnly: 'Saturday (appointment only)'         }       }     };      function getLocalePack() {       return LOCALES[CONFIG.locale] || LOCALES.es;     }      function getStoreElement(storeId) {       return document.querySelector('[data-location-id="' + storeId + '"]');     }      function setTextIfFound(elements, value) {       elements.forEach(function (el) {         if (el) {           el.textContent = value;         }       });     }      function updateGlobalLabels() {       var localePack = getLocalePack();       var labels = document.querySelectorAll('#scasl-operating-hours-label');       var phones = document.querySelectorAll('#scasl-phone-label');       var distances = document.querySelectorAll('#scasl-distance-label');        labels.forEach(function (el) { el.textContent = localePack.labels.hours; });       phones.forEach(function (el) { el.textContent = localePack.labels.phone; });       distances.forEach(function (el) { el.textContent = localePack.labels.distance; });     }      function updateDayText(storeConfig, storeElement) {       var localePack = getLocalePack();       var cells = storeElement.querySelectorAll('td.oh-item');        cells.forEach(function (cell) {         var text = cell.textContent.trim();          storeConfig.dayTextRules.forEach(function (rule) {           var matched = rule.match.some(function (candidate) {             return text === candidate;           });            if (matched && localePack.messages[rule.replacementKey]) {             cell.textContent = localePack.messages[rule.replacementKey];           }         });       });     }      function ensureNoticeElement(container, selector, className, styles, insertAfterSelector) {       var existing = container.querySelector(selector);       if (existing) return existing;        var el = document.createElement('div');       el.className = className;       el.style.cssText = styles;        if (insertAfterSelector) {         var anchor = container.querySelector(insertAfterSelector);         if (anchor && anchor.parentNode) {           anchor.parentNode.insertBefore(el, anchor.nextSibling);           return el;         }       }        container.appendChild(el);       return el;     }      function updateStoreNotice(storeConfig, storeElement) {       var localePack = getLocalePack();       var today = new Date().getDay();       var shouldShow = storeConfig.restrictedDays.indexOf(today) !== -1;       var message = shouldShow ? localePack.messages.todayAppointmentOnly : '';        var bodyNotice = ensureNoticeElement(         storeElement,         '.rp-appointment-notice',         'rp-appointment-notice',         'color:#b00;font-weight:bold;font-size:13px;margin-top:4px;',         '.maximize-oh-status'       );       bodyNotice.textContent = message;        var header = storeElement.querySelector('.scasl-operating-hours-label');       if (header) {         var headerNotice = ensureNoticeElement(           header,           '.rp-appointment-notice-header',           'rp-appointment-notice-header',           'color:#b00;font-weight:bold;font-size:12px;margin-top:2px;'         );         headerNotice.textContent = message;       }     }      function updateStore(storeConfig) {       var storeElement = getStoreElement(storeConfig.id);       if (!storeElement) return;        updateDayText(storeConfig, storeElement);       updateStoreNotice(storeConfig, storeElement);     }      function applyAllUpdates() {       updateGlobalLabels();       CONFIG.stores.forEach(updateStore);     }      function debounce(fn, delay) {       var timeout;       return function () {         clearTimeout(timeout);         timeout = setTimeout(fn, delay);       };     }      function limitedRetry(fn, interval, maxAttempts) {       var attempts = 0;       var timer = setInterval(function () {         attempts += 1;         fn();         if (attempts >= maxAttempts) {           clearInterval(timer);         }       }, interval);     }      function startObserver() {       var debouncedApply = debounce(applyAllUpdates, 300);       var observer = new MutationObserver(function (mutations) {         var shouldRun = mutations.some(function (mutation) {           return mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0;         });          if (shouldRun) {           debouncedApply();         }       });        observer.observe(document.body, {         childList: true,         subtree: true       });     }      window.addEventListener('load', function () {       applyAllUpdates();       limitedRetry(applyAllUpdates, 1000, 5);       startObserver();     });   } catch (error) {     console.warn('RP store locator customization error:', error);   } })(); </script>

How to Configure It

Change the Language

Set the active locale here:

locale: 'es'

Available examples in this template:

  • es = Spanish

  • en = English

To add another language, copy one locale block and translate the labels and messages.


Add or Update a Store

Each store is defined inside the stores array:

{   id: '18535034',   key: 'acassuso',   restrictedDays: [1, 6],   dayTextRules: [     { match: ['Lunes'], replacementKey: 'mondayAppointmentOnly' },     { match: ['Sabado', 'Sábado'], replacementKey: 'saturdayAppointmentOnly' }   ] }

Update:

  • id with the correct location ID

  • restrictedDays with the JavaScript day numbers

  • dayTextRules with the exact day values used by your locator


Add Another Language

Example structure:

fr: {   labels: {     hours: 'Horaires',     phone: 'Téléphone',     distance: 'Distance'   },   messages: {     todayAppointmentOnly: '⚠️ Aujourd’hui sur rendez-vous uniquement',     mondayAppointmentOnly: 'Lundi (sur rendez-vous uniquement)',     saturdayAppointmentOnly: 'Samedi (sur rendez-vous uniquement)'   } }

Why This Version Is Production-Ready

This template is safer for live use because it:

  • centralizes customer-facing text

  • supports multiple stores in one script

  • avoids duplicating logic across store blocks

  • re-applies updates when dynamic locator content reloads

  • keeps day rules separate from language rules


Common Mistakes

1. Wrong Location ID

  • Using an incorrect or outdated ID will prevent the script from applying

  • Always verify IDs using the export file


2. Using Staging vs Live Data

  • IDs may differ between staging and production environments

  • Make sure you are using IDs from the live environment if testing on the live site


3. Text Matching Fails

  • Exact matches like Lunes or Sábado may fail if:

    • accents differ

    • casing is different

    • the platform outputs a different language


4. Script Runs Too Early

  • If elements are not loaded yet, the script won’t find them

  • Ensure it runs after page load or uses a retry/observer method


5. Multiple Scripts Overwriting Each Other

  • Another script may overwrite your text changes

  • Check for duplicate custom scripts or theme conflicts


6. Not Updating All Message Locations

  • Some messages appear in multiple places (header + body)

  • Make sure all instances are updated for consistency


Troubleshooting

If changes do not appear:

  • Confirm the correct data-location-id

  • Check that day text matches exactly

  • Verify JavaScript day values (0–6)

  • Ensure script runs after page load

  • Look for console errors


Quick Checklist

Before publishing:

  • Correct store IDs

  • Correct day logic

  • Correct language text

  • Labels updated

  • Accents handled

  • Notice appears in both header and body


Summary

This setup allows you to:

  • Customize messaging per store

  • Control visibility by day

  • Translate locator content

  • Scale across multiple languages

Spanish is used as the example, but this system is fully adaptable to any language or region.


© Rose Perl Technology

Did this answer your question?