PrestaShop is a popular open-source e-commerce platform that allows users to create online stores. It uses the Smarty template engine to display the content on the front-end of the website. Smarty is a powerful template engine that separates the PHP code from the HTML code, making it easy to modify the template without touching the PHP code. This article brings together the main smarty variables used on Prestashop since version 1.7. These variables can be used to display different types of content on the front-end of the website.
Prestashop variables for URLs
All the variables to access certain folders on your Prestashop site, to access a page or generate a URL.
Prestashop Global URLs
{$urls.base_url} | Your site’s home page URL |
{$urls.current_url} | URL of current page |
{$urls.shop_domain_url} | Store domain name |
{$urls.img_ps_url} | URL of your site’s image directory |
{$urls.img_cat_url} | Category image URLs |
{$urls.img_lang_url} | URL of the images of the languages of the site |
{$urls.img_prod_url} | Product Image URLs |
{$urls.img_manu_url} | Manufacturer image URLs |
{$urls.img_sup_url} | Vendor Linked Image URLs |
{$urls.img_ship_url} | Carrier Related Image URLs |
{$urls.img_store_url} | Stores related image URLs |
{$urls.img_url} | Your theme image URLs |
{$urls.css_url} | URLs of your theme’s CSS files |
{$urls.js_url} | URL of your theme’s javascript files |
{$urls.pic_url} | /upload directory URL |
Prestashop dynamic URLs
{url entity=’product’ id=$id_product } | Dynamic URL to a product |
{url entity=’category’ id=$id_category } | Dynamic URL to a category |
{url entity=’categoryImage’ id=$id_category type=’…’ } | Dynamic URL to a category image |
{url entity=’cms’ id=$id_cms } | Dynamic URL to a CMS page |
{url entity=’module’ name=’…’ controller=’…’} | Dynamic URL to a module page |
{url entity=’language’ id=$id_lang} | Dynamic URL to another language |
{url entity=’sf’ route=’…’ sf-params=’…’ } | Dynamic URL to a page managed by Symfony |
{entityurl=’…’ } | Dynamic URL to a specific page (contact, cart, stores, …) |
Prestashop page URLs
{$urls.pages.address} | Client-side “My address” page URL |
{$urls.pages.addresses} | URL of the “My addresses” page on the client side |
{$urls.pages.authentication} | Login Page URL |
{$urls.pages.cart} | Cart Page URL |
{$urls.pages.category} | Category page URL |
{$urls.pages.cms} | CMS Page URL |
{$urls.pages.contact} | bsp;: contact page url |
{$urls.pages.discount} | the URL of the promotions page |
{$urls.pages.guest_tracking} | Order tracking URL for customers in the “Guests” group |
{$urls.pages.history} | Order History URL |
{$urls.pages.identity} | Client-side personal information page URL |
{$urls.pages.index} | Page URL |
{$urls.pages.my_account} | URL of the “My Account” page |
{$urls.pages.order_confirmation} | Order Confirmation Page URL |
{$urls.pages.order_follow} | Order Tracking Page URL |
{$urls.pages.order} | Order page URL ! |
{$urls.pages.order_return} | URL of the order return page, useful in particular for setting up payment modules |
{$urls.pages.order_slip} | URL to call for the purchase order |
{$urls.pages.pagenotfound} | 404 Page URL |
{$urls.pages.password} | Password recovery page URL (“Forgot your password?”) |
{$urls.pages.pdf_invoice} | Invoice PDF URLs |
{$urls.pages.pdf_order_return} | Order Return PDF URLs |
{$urls.pages.pdf_order_slip} | Purchase Order PDF URL |
{$urls.pages.prices_drop} | URL of the page listing the products at reduced prices |
{$urls.pages.product} | Product Sheet URL |
{$urls.pages.search} | Search Page URL |
{$urls.pages.sitemap} | Sitemap page (not to be confused with sitemap) |
{$urls.pages.stores} | Page listing your stores |
{$urls.pages.supplier} | Page listing your manufacturers |
{$urls.pages.register} | Account creation page URL |
{$urls.pages.order_login} | Connection URL from command tunnel |
{$urls.theme_assets} | URL to your theme’s /assets directory (containing CSS, JS, IMGs, etc.) |
{$urls.actions.logout} | Customer Logout URL |
Prestashop variables for information
The list of all Prestashop variables allowing you to easily display certain information in your smarty templates.
Prestashop page variables
{$page.meta.title} | Page title meta tag |
{$page.meta.description} | Page description meta tag |
{$page.page_name} | Page name |
Prestashop Store Variables
{$shop.name} | Shop name |
{$shop.email} | Email associated with the store |
{$shop.logo} | Shop logo |
{$shop.favicon} | Store favicon |
{$shop.address.address1} | Address field 1 of your shop |
{$shop.address.address2} | Address field 2 of your store |
{$shop.address.postcode} | Zip code of your store |
{$shop.address.city} | City of your store |
{$shop.address.state} | Province of your store |
{$shop..address.country} | Country of your store |
{$shop.phone} | Phone of your store |
{$shop.fax} | Fax from your shop |
Prestashop Language variables
{$language.name} | Language name |
{$language.iso_code} | Active language ISO code |
{$language.language_code} | Active language code |
{$language.is_rtl} | Is the language read from right to left (“rtl = right to left”) |
{$language.id} | Language ID |
Prestashop variables of customer information
{$customer.lastname} | Customer’s last name |
{$customer.firstname} | Customer’s first name |
{$customer.email} | Customer email |
{$customer.birthday} | Customer’s date of birth |
{$customer.newsletter} | Indicates if the customer is subscribed to the newsletter |
{$customer.newsletter_date_add} | Newsletter subscription date |
{$customer.ip_registration_newsletter} | Newsletter registration IP |
{$customer.optin} | Indicates if the customer is subscribed to commercial offers |
{$customer.date_add} | Date of creation of the customer account |
{$customer.date_upd} | customer account update date |
{$customer.id} | Customer ID |
{$customer.id_default_group} | Default client group ID |
{$customer.is_logged} | Indicates if the client is connected |
{$customer.gender.name[$customer.gender.id]} | Client Gender |
{$customer.addresses[id_address].city} | Customer addresses |
Prestashop variables of customer addresses
{$customer.addresses[id_address].alias} | Address alias |
{$customer.addresses[id_address].firstname} | First name linked to the address |
{$customer.addresses[id_address].lastname} | Name linked to address |
{$customer.addresses[id_address].company} | Company linked to address |
{$customer.addresses[id_address].address1} | First address field |
{$customer.addresses[id_address].address2} | Second address fields |
{$customer.addresses[id_address].postcode} | Postal code of the address |
{$customer.addresses[id_address].id_state} | Country ID |
{$customer.addresses[id_address].state} | State or province |
{$customer.addresses[id_address].state_iso} | ISO state or province code |
{$customer.addresses[id_address].id_country} | Address Country ID |
{$customer.addresses[id_address].country} | Name of the country |
{$customer.addresses[id_address].country_iso} | ISO code of this country |
{$customer.addresses[id_address].phone} | Fixed telephone number linked to the address |
{$customer.addresses[id_address].phone_mobile} | Mobile phone number linked to the address |
{$customer.addresses[id_address].dni} | Address DNI |
{$customer.addresses[id_address].vat_number} | Customer’s intra-community VAT number |
{$customer.addresses[id_address].formatted} | Customer’s formatted address |
Also, there are some most common variables listed below
$cart
The $cart variable contains information about the current shopping cart. It includes the total number of products, the total amount, and other information about the cart.
$categories
The $categories variable contains information about the categories of products that are available on the website. It includes the category name, ID, and other information.
$cms
The $cms variable contains information about the CMS pages that are available on the website. It includes the page title, content, and other information.
$content_only
The $content_only variable is used to display only the content of a page without any header, footer, or other elements.
$cookie
The $cookie variable contains information about the user’s cookie preferences. It includes the language, currency, and other preferences.
$customer
The $customer variable contains information about the current customer. It includes the customer’s name, email, and other information.
$display_footer
The $display_footer variable is used to display the footer of the website.
$display_header
The $display_header variable is used to display the header of the website.
$errors
The $errors variable is used to display any errors that occurred during a process. It includes the error message and other information.
$groups
The $groups variable contains information about the customer groups that are available on the website. It includes the group name, ID, and other information.
$id_category
The $id_category variable contains the ID of the current category.
$id_lang
The $id_lang variable contains the ID of the current language.
$id_product
The $id_product variable contains the ID of the current product.
$is_logged
The $is_logged variable is used to check if the customer is logged in or not.
$link
The $link variable is used to create links to different pages on the website.
$order_by
The $order_by variable is used to specify the order in which the products should be displayed.
$order_way
The $order_way variable is used to specify the direction in which the products should be displayed.
$page
The $page variable contains the current page number.
$page_name
The $page_name variable contains the name of the current page.
$product
The $product variable contains information about the current product. It includes the product name, price, and other information which can be used to get information about a product.
$ps_currencies
The $ps_currencies variable contains information about the currencies that are available on the website. It includes the currency symbol, name, and other information.
$ps_languages
The $ps_languages variable contains information about the languages that are available on the website. It includes the language name, ISO code, and other information.
$smarty
The $smarty variable contains information about the Smarty template engine. It includes the version number, template directory, and other information.
$static_token
The $static_token variable is used to ensure the security of the website. It contains a unique token that is used to validate forms and prevent CSRF attacks.
$template
The $template variable contains the name of the current template that is being used.
$tpl_dir
The $tpl_dir variable contains the path to the current template directory.
$url
The $url variable is used to create URLs to different pages on the website.
$user
The $user variable contains information about the current user. It includes the user name, email, and other information.
$var_assign
The $var_assign variable is used to assign a value to a variable.
$var_dump
The $var_dump variable is used to display the contents of a variable.
These are the Smarty variables that are available in PrestaShop 1.7. These variables can be used to display different types of content on the front-end of the website and to ensure the security of the website. As a developer or designer, it’s essential to have a good understanding of these variables to create a customized and functional e-commerce store.
If you are looking for someone who has a good understanding of Prestashop programming or if you are looking for a dedicated PrestaShop developer to create a custom module to add a new feature to your PrestaShop store. You can Contact Me from the contact page of this website or hire me on Upwork or Fiverr.