Skip to content

Global Variables: $page and $themes

Every Blade template in the system has access to two primary global objects: $page and $themes. These are injected automatically via the ThemeViewContext service — you do not need to fetch them yourself.


The $page Object

The $page object contains the current user, site settings, and request data. It is available in all page templates.

{{-- Access the site title --}}
{{ $page->settings->siteTitle }}

{{-- Check if logged in --}}
@if($page->user)
    Welcome, {{ $page->user->name }}
@endif

$page->settings — Site-Wide Settings

These settings come from the admin panel and control site-wide behavior.

Variable Type Description
$page->settings->siteTitle string The store's display name
$page->settings->metaKeywords string Default SEO keywords
$page->settings->metaDescription string Default SEO meta description
$page->settings->catalogMode int 0\|1 1 = catalog mode (no cart/checkout)
$page->settings->loginMode int 0\|1 1 = login is required to browse
$page->settings->signupMode int 0\|1 1 = new registrations are disabled
$page->settings->emailMode int 0\|1 1 = email subscriptions enabled
$page->settings->facebookShare int 0\|1 1 = Facebook sharing is enabled
$page->settings->previewmode int 0\|1 1 = theme is in demo mode
$page->settings->noProductImage string URL of the fallback product image
$page->settings->customerCredit float Current customer's store credit balance
$page->settings->google_status int 0\|1 1 = Google OAuth login is enabled
$page->settings->facebook_status int 0\|1 1 = Facebook OAuth login is enabled
$page->settings->amazon_status int 0\|1 1 = Amazon OAuth login is enabled
$page->settings->email_verification int 0\|1 1 = email verification on registration

Registration-specific settings:

Variable Type Description
$page->settings->First_And_Last_Name_Min_Value int Min length for first/last name
$page->settings->First_And_Last_Name_Max_Value int Max length for first/last name
$page->settings->Password_Min_Value int Min password length
$page->settings->Password_Max_Value int Max password length
$page->settings->Email_Empty_Message string Validation message for empty email
$page->settings->Email_Already_Exits_Message string Message when email is taken
$page->settings->Email_Available_Message string Message when email is available
$page->settings->New_User_Create_Account_Message string Text shown in new user box on login page

$page->user — The Authenticated User

$page->user is the currently authenticated customer object, or null for guests.

@if($page->user)
    <p>Hello, {{ $page->user->name }}</p>
    <p>Your credit balance: ${{ $page->settings->customerCredit }}</p>
@else
    <a href="{{ customUrl('login') }}">Please log in</a>
@endif
Property Type Description
$page->user->customer_id int Unique customer ID
$page->user->name string First name
$page->user->last_name string Last name
$page->user->email string Customer email address
$page->user->phone string Customer phone number
$page->user->is_bulk_buyer string 'Y'\|'N' Bulk buyer status
$page->user->is_guest int 0\|1 Whether this is a guest account

$page->misc — Page-Specific Data

$page->misc is an object containing data that varies by page (e.g., the current product, order, etc.). Each page's documentation section lists its specific misc keys. Common examples:

{{-- On product detail page --}}
{{ $page->misc->product->name }}

{{-- On login page --}}
{{ $page->misc->redirect }}

The $themes Object

$themes contains all theme-specific settings configured in the admin panel under the theme's settings. These are key-value pairs that you can use to make your theme configurable.

{{-- Check for a theme-level setting --}}
@if(getPath($themes->header_image ?? null))
    <img src="{{ getPath($themes->header_image) }}" alt="Logo">
@endif

{{-- Apply a configured background color --}}
<div style="background: {{ $themes->product_background_color ?? '#ffffff' }};">

Common $themes Settings

Key Type Description
$themes->header_image asset Logo image configured in admin
$themes->banner_image asset Homepage banner image
$themes->default_image asset Fallback product image
$themes->product_background_color string Background color for product images
$themes->homepage_meta_keyword string Homepage-specific SEO keywords
$themes->homepage_meta_tag_description string Homepage-specific SEO description
$themes->demo_mode int 0\|1 Whether the theme is in demo mode

Note

The keys available in $themes depend on what settings the admin has configured. Use the null coalescing operator (??) to provide defaults: $themes->my_setting ?? 'default'.


Other Global Variables

In addition to $page and $themes, these variables are also available in all templates:

Variable Type Description
$app->version string Application version string
$twitterShareMessage string Default Twitter share message
$config['facebookApplicationId'] string Facebook App ID for Open Graph
$userInfo object Quick access to the current user or a guest object

$userInfo — Quick User Object

$userInfo is similar to $page->user, but always returns an object (even for guests):

{{ $userInfo->name }}      {{-- Guest or customer first name --}}
{{ $userInfo->lastName }}  {{-- Guest or customer last name --}}
{{ $userInfo->isGuest }}   {{-- true if not logged in --}}