Skip to main content

Twig Objects

This page documents the global variables available in your Twig templates.

The site Object

The site variable provides access to global site information, settings, and configurations. It is an instance of SiteInfoApiModel.

Site Basic Information

Access basic site details via site.site:

  • site.site.name: The name of the site.
  • site.site.domain: The primary domain of the site.
  • site.site.host: The hostname.
  • site.site.protocol: The protocol (http/https).
  • site.site.logo: URL to the site logo.
  • site.site.icon: URL to the site favicon.
  • site.site.description: Site description.
  • site.site.locale: The site locale (e.g., 'nl_NL').
  • site.site.socialMedia: Array of social media links.
  • site.language: The current language code (e.g., 'nl').

SEO Information

Global SEO settings are available via site.seo:

  • site.seo.canonical: Global canonical URL.
  • site.seo.metaDescription: Default meta description.
  • site.seo.openGraphDescription: Default Open Graph description.
  • site.seo.jsonLd: Global JSON-LD structured data.
  • site.seo.sitemapUrl: URL to the sitemap.
  • site.seo.robotsUrl: URL to the robots.txt file.
  • site.navigation: Array of navigation items for the main menu.
  • site.footerElements: Array of elements/links for the footer.

Theme & Design

  • site.themeSettings: Comprehensive theme configuration.
    • site.themeSettings.header: Header specific settings.
    • site.themeSettings.footer: Footer specific settings.
    • site.themeSettings.homepage: Homepage layout settings.
    • site.themeSettings.design: General design settings (colors, fonts).
  • site.designSettings: Raw design settings array.
  • site.customTheme: Custom theme information (if applicable).

Custom HTML & Scripts

Used for injecting custom code into different parts of the page:

  • site.customHtml.css: Custom CSS block.
  • site.customHtml.htmlHead: HTML to be injected in the <head>.
  • site.customHtml.htmlBody: HTML to be injected at the start of <body>.
  • site.customHtml.htmlCart: HTML for the cart page.
  • site.customHtml.htmlCheckout: HTML for the checkout page.

Pop-up Configuration

  • site.popUp.active: Boolean indicating if the pop-up is enabled.
  • site.popUp.title: Pop-up title.
  • site.popUp.content: Pop-up HTML content.
  • site.popUp.backgroundColor: Background color hex code.
  • site.popUp.titleColor: Title text color hex code.
  • site.popUp.contentColor: Content text color hex code.
  • site.legalPolicies: Array of legal documents (Terms, Privacy Policy, etc.).

Modules & Settings

  • site.modules: Array of enabled modules and their configurations.
  • site.settings: Array of general site settings.
  • site.getSetting('key'): Method to retrieve a specific setting by its key.

The product Object

The ProductApiModel provides a comprehensive set of getters to access product information within Twig templates. When working with a product object (e.g., product), you can use the following properties and methods.

Basic Product Information

  • product.id: Returns the unique integer ID of the product.
  • product.uuid: Returns the UUID string of the product.
  • product.name: Returns the full name of the product.
  • product.nameWithoutBrand: Returns the name of the product excluding the brand name.
  • product.slug: Returns the URL-friendly slug of the product.
  • product.url: Returns the relative URL to the product page.
  • product.canonical: Returns the canonical URL of the product.
  • product.brand: Returns the brand name of the product.
  • product.model: Returns the model name/number of the product.
  • product.sku: Returns the Stock Keeping Unit (SKU) of the product.
  • product.upc: Returns the Universal Product Code (UPC) of the product.
  • product.upcParent: Returns the parent UPC if applicable.
  • product.condition: Returns the condition of the product (e.g., 'new').
  • product.importSource: Returns the source from which the product was imported.

Media & Descriptions

  • product.image: Returns the main image URL of the product.
  • product.images: Returns an array of all image URLs for the product.
  • product.video: Returns a video URL associated with the product.
  • product.description: Returns the full HTML description of the product.
  • product.shortDescription: Returns a brief summary of the product.
  • product.pdf: Returns a URL to a PDF document (e.g., manual or datasheet).

Pricing

  • product.priceCents: Returns the current price in cents (integer).
  • product.pricePromo: Returns the promotional price (float).
  • product.pricePromoCents: Returns the promotional price in cents (integer).
  • product.priceAdvised: Returns the manufacturer's suggested retail price (MSRP) (float).
  • product.priceAdvisedCents: Returns the MSRP in cents (integer).
  • product.disableProductSales: Boolean indicating if sales are disabled for this product.

Categorization & Attributes

  • product.categoryMain: Returns a ProductCategoryApiModel for the main category.
    • Usage: product.categoryMain.name, product.categoryMain.url
  • product.categorySub: Returns a ProductCategoryApiModel for the sub-category.
  • product.categorySubSub: Returns a ProductCategoryApiModel for the sub-sub-category.
  • product.facets: Returns an array of product facets/attributes.

SEO Information

  • product.seo: Returns a SeoApiModel containing SEO metadata.
    • product.seo.canonical: The canonical URL.
    • product.seo.metaDescription: The meta description string.
    • product.seo.openGraphDescription: The description for Open Graph (social media).
    • product.seo.jsonLd: The JSON-LD structured data.
    • product.seo.customTitleTag: A custom title tag if set.
    • product.seo.mainImage: The primary image for SEO/social sharing.
    • product.seo.noIndex: Boolean indicating if robots should not index the page.
    • product.seo.allowIndex: Boolean indicating if indexing is allowed.

Variants & Bundles

  • product.variants: Returns a ProductVariantsApiModel containing variant information.
    • product.variants.totalProducts: Total number of variant combinations.
    • product.variants.rootLevelAttributes: Array of attributes used for variants.
    • product.variants.productCombinations: Array of possible product combinations.
  • product.bundles: Returns an array of product bundles.

Dates

  • product.created: Returns the creation date (DateTimeInterface).
  • product.modified: Returns the last modification date (DateTimeInterface).