DEV Community

Roberto Morais
Roberto Morais

Posted on

Global Variables in PrestaShop

If you are programming a module for prestashop, these are the variables accessible from any TPL.

For currency:

  • Active currency name: $currency.name
  • Language code in ISO format: $currency.iso_code
  • Active currency symbol: $currency.sign
  • Currency code in ISO format: $currency.iso_code_num

For languaje:

  • Language ID enabled: $language.id
  • Enabled language name: $language.name
  • Language code in ISO format: $language.iso_code
  • Enabled Language Code: $language.language_code
  • For when language is written from right to left: $language.is_rtl
  • Small date format: $language.format_lite
  • Long date format: $language.format_full

For shop:

  • Store name: $shop.name
  • Store Email: $shop.email}
  • SRC store logo: $shop.logo
  • SRC favicon image: $shop.favicon
  • Store address 1: $shop.address.address1
  • Store address 2: $shop.address.address2
  • Store Zip Code $shop.address.postcode
  • Store City: $shop.address.city
  • Province/State of the store: $shop.address.state
  • Shop Country: $shop..address.country
  • Store phone: $shop.phone
  • Store Fax: $shop.fax

For customer:

  • Customer ID: $customer.id
  • Customer Last Name: $customer.lastname
  • Client Name: $customer.firstname
  • Customer Email: $customer.email
  • Client birthday: $customer.birthday
  • Subscribed to the newsletter (1 subscribed / 0 unsubscribed): $customer.newsletter
  • Newsletter subscription date: $customer.newsletter_date_add
  • IP of registered user in newsletter: $customer.ip_registration_newsletter
  • Subscribed to offers from our partners: $customer.optin
  • Client creation date: $customer.date_add
  • Last date of the updated client update: $customer.date_upd
  • Default group to which the client is associated: $customer.id_default_group
  • Check if the client is "logged in": $customer.is_logged
  • Client Gender (Mr / Ms): $customer.gender.name[$customer.gender.id]

For customer address

Address_ID indicates the address id, because a customer can have multiple addresses.

  • Client city of address: $customer.addresses[Address_ID].city
  • Address name: $customer.addresses[Address_ID].alias
  • Addressholder last name: $customer.addresses[Address_ID].firstname
  • Name of address holder: $customer.addresses[Address_ID].lastname
  • Company name of address holder: $customer.addresses[Address_ID].company
  • Address 1: $customer.addresses[Address_ID].address1
  • Address 2: $customer.addresses[Address_ID].address2
  • Mailing address: $customer.addresses[Address_ID].postcode
  • Address Province ID: $customer.addresses[Address_ID].id_state
  • Province address: $customer.addresses[Address_ID].state
  • ISO address province code: $customer.addresses[Address_ID].state_iso
  • Country address ID: $customer.addresses[Address_ID].id_country
  • Country of address: $customer.addresses[Address_ID].country
  • ISO country address code: $customer.addresses[Address_ID].country_iso
  • Address phone: $customer.addresses[Address_ID].phone
  • Mobile phone address: $customer.addresses[Address_ID].phone_mobile
  • Customer VAT number: $customer.addresses[Address_ID].vat_number
  • Client formatted address: $customer.addresses[Address_ID].formatted
  • DNI number: $customer.addresses[Address_ID].dni

For url

  • Store url address: $urls.base_url
  • Current url address where we are : $urls.current_url
  • Store domain: $urls.shop_domain_url
  • Url of image directory: $urls.img_ps_url
  • Url of images of the categories directory: $urls.img_cat_url
  • Url of the language images directory: $urls.img_lang_url
  • Url of the product images directory: $urls.img_prod_url
  • Url of manufacturers images directory: $urls.img_manu_url
  • Url of the suppliers directory: $urls.img_sup_url
  • Url of images of carriers directory: $urls.img_ship_url
  • Url of images of stores directory: $urls.img_store_url
  • Url of the image directory of the template : $urls.img_url
  • Url of css directory: $urls.css_url
  • Url of js directory: $urls.js_url
  • Url of file directory uploaded: $urls.pic_url
  • Url of the "My Address" section: $urls.pages.address
  • Url of the "My addresses" section: $urls.pages.addresses
  • Url of the authentication page: $urls.pages.authentication
  • Url of the cart: $urls.pages.cart
  • Url of the Categories: $urls.pages.category
  • Url of the static pages section: $urls.pages.cms
  • Url of the contact form page: $urls.pages.contact
  • Url of the discount voucher section: urls.pages.discount
  • Tracking url for unregistered clients: $urls.pages.guest_tracking
  • Url of the order history page: $urls.pages.history
  • Url of the page "Personal data": $urls.pages.identity
  • Url of the home page: $urls.pages.index
  • Url of my account page: $urls.pages.my_account
  • Url of the order confirmation page: $urls.pages.order_confirmation
  • Url of the order tracking page: $urls.pages.order_follow
  • Url of the order page: $urls.pages.order
  • Url of the return order page: $urls.pages.order_return
  • Url of the slip order page: $urls.pages.order_slip
  • Url ol the not fount page (404): $urls.pages.pagenotfound
  • Url of the recover password page: $urls.pages.password
  • Url of the invoice page for download: $urls.pages.pdf_invoice
  • Url of the return order slip page for download: $urls.pages.pdf_order_return
  • Url of the ticket page for download: $urls.pages.pdf_order_slip
  • Url of the section products discount/discounts : $urls.pages.prices_drop
  • Url of the product page: $urls.pages.product
  • Url of the searcher page: $urls.pages.search
  • Url of the site map: $urls.pages.sitemap
  • Url of the Our stores page: $urls.pages.stores
  • Url of the the providers page: $urls.pages.supplier
  • Url of the register form: $urls.pages.register
  • Url of the login form in checkout: $urls.pages.order_login
  • Url of the "assets" directory: $urls.theme_assets
  • Url to close session of the user: $urls.actions.logout

I hope this helps you as much as it does me.

Top comments (1)

Collapse
 
josepedrolorenzini profile image
Jose_Lorenzini

oh man i have been looking for this for so long this is gold , Gracias Roberto