Skip to main content
The notifications page displays system notifications and updates for the customer.

Template location

src/views/pages/customer/notifications.twig

Available variables

VariableTypeDescription
page.titlestringPage title
page.slugstringPage slug
notificationsPaginatorPaginated notifications collection
notifications.next_pagestringURL for next page of results
notifications.countintTotal notification count

Notification object

VariableTypeDescription
notification.is_newboolWhether notification is unread
notification.urlstringNotification link URL
notification.titlestringNotification title
notification.sub_titlestringNotification subtitle/description
notification.datestringNotification date

Page structure

The notifications page uses the salla-notifications web component to handle displaying and managing notifications:
{% extends "layouts.customer" %}
{% block inner_content %}
  <salla-notifications></salla-notifications>
{% endblock %}

Code examples

Basic notifications display

{% if notifications|length %}
  {% for notification in notifications %}
    <div class="notification {{ notification.is_new ? 'unread' : 'read' }}">
      <a href="{{ notification.url }}">
        <h3>{{ notification.title }}</h3>
        <p>{{ notification.sub_title }}</p>
        <span class="date">{{ notification.date }}</span>
      </a>
    </div>
  {% endfor %}
{% else %}
  <div class="no-notifications">
    <p>{{ trans('pages.notifications.no_notifications') }}</p>
  </div>
{% endif %}

Using the Salla component

<salla-notifications></salla-notifications>
This component automatically handles:
  • Displaying notifications with proper styling
  • Marking notifications as read
  • Pagination
  • Real-time updates

Custom notification styling

{% for notification in notifications %}
  <div class="notification-item {{ notification.is_new ? 'new' : '' }}">
    {% if notification.is_new %}
      <span class="badge">{{ trans('pages.notifications.new') }}</span>
    {% endif %}
    
    <a href="{{ notification.url }}" class="notification-link">
      <div class="notification-content">
        <h4 class="notification-title">{{ notification.title }}</h4>
        <p class="notification-subtitle">{{ notification.sub_title }}</p>
      </div>
      <time class="notification-date">{{ notification.date }}</time>
    </a>
  </div>
{% endfor %}

Pagination

<div class="notifications-container">
  {% for notification in notifications %}
    {# Notification content #}
  {% endfor %}
</div>

{% if notifications.next_page %}
  <a href="{{ notifications.next_page }}" class="load-more">
    {{ trans('common.elements.load_more') }}
  </a>
{% endif %}

Notification count

<div class="notifications-header">
  <h1>{{ trans('pages.notifications.title') }}</h1>
  {% if notifications.count %}
    <span class="count">{{ notifications.count }}</span>
  {% endif %}
</div>

Hooks

The notifications page provides hooks for customization:
{% hook 'customer:notifications.items.start' %}
<salla-notifications></salla-notifications>
{% hook 'customer:notifications.items.end' %}

Common notification types

Notifications may include:
  • Order status updates
  • Shipping updates
  • Product availability alerts
  • Promotional messages
  • Account activity
  • Product reviews
  • Wishlist updates
The notifications page extends the layouts.customer layout. The salla-notifications component handles all notification logic including loading, marking as read, and real-time updates.

Build docs developers (and LLMs) love