Jump to content

Question

I'm trying to port a module from PS 1.6 to PS 1.7.

My module used some global smarty variables like {$lang_iso} and {$cart->id_shop}

 

In PS1.7 this variables don't return anything. Has something changed or is a different way to approach this?

 

 

Thanks

Share this post


Link to post
Share on other sites

16 answers to this question

Recommended Posts

  • 0

hi,

 

I would like to know gobal smarty variable on prestashop 1.7 . Like $page_name was on pretashop 1.6x. That would be great if you guys have any idea with gobal variable on prestashop 1.7

Try {$page}. See what it contains with {$page|var_dump}

Edited by Daniel Patilea

Share this post


Link to post
Share on other sites
  • 0

Yes, this has changed in PrestaShop v1.7. There are many Smarty variables that are no longer available. The new convention is that objects should not be passed into templates, only the values you need to use, so you should create {$lang_iso} and {$id_shop} variables in your module.

Share this post


Link to post
Share on other sites
  • 0

hi,

 

I would like to know gobal smarty variable on prestashop 1.7 . Like $page_name was on pretashop 1.6x. That would be great if you guys have any idea with gobal variable on prestashop 1.7

Share this post


Link to post
Share on other sites
  • 0

Hello,

  I have a problem with variable smarty for page checkout.

 

It is possible insert total product (without tax)? and then it is possible insert total tax? And finally, the total price with tax?

 

Thank you very much.

 

Best Regards

 

Luca Gigli

Share this post


Link to post
Share on other sites
  • 0

Ok for {$page.page_name}, it works just fine.

But what about other smarty global variables like shop_name, etc... ?

Share this post


Link to post
Share on other sites
  • 0

 so you should create {$lang_iso} and {$id_shop} variables in your module.

 

Sorry but what do you mean by "create"? Those 2 variables don't exist anymore ?

Share this post


Link to post
Share on other sites
  • 0

Sorry but what do you mean by "create"? Those 2 variables don't exist anymore ?

 

Yes. Those variables don't exists anymore and you need to create them in your module then assign them to the template.

Share this post


Link to post
Share on other sites
  • 0

http://victor-rodenas.com/variables-globales-en-prestashop-1-7/

 

It's in Spanish, but you will get the point. For future reference:

 {$currency|var_dump}:

{$currency.name} -> Nombre de la moneda activa.
{$currency.iso_code} -> Código ISO del idioma activado.
{$currency.sign} -> Símbolo de la moneda activa
{$currency.iso_code_num} -> Código ISO de la Moneda activa

 {$shop|var_dump}:

{$shop.name} -> Nombre de la tienda en Prestashop 1.7
{$shop.email} -> Email de la tienda en Prestashop 1.7
{$shop.logo} ->  Ruta imagen logo de la tienda en Prestashop 1.7
{$shop.favicon} ->  Ruta imagen favicon de la tienda en Prestashop 1.7
{$shop.address.address1} -> Dirección 1 de la tienda en Prestashop 1.7
{$shop.address.address2} -> Dirección 2 de la tienda en Prestashop 1.7
{$shop.address.postcode} -> Codigo Postal de la tienda en Prestashop 1.7
{$shop.address.city} -> Ciudad de la tienda en Prestashop 1.7
{$shop.address.state} -> Provincia de la tienda en Prestashop 1.7
{$shop..address.country} -> País de la tienda en Prestashop 1.7
{$shop.phone} -> Telefono de la tienda en Prestashop 1.7
{$shop.fax} -> Fax de la tienda en Prestashop 1.7

 {$language|var_dump}:

{$language.name} -> Nombre del idioma activado
{$language.iso_code} -> Código ISO del idioma activado
{$language.language_code} -> Código idioma activado (es para el Español, fr para el Francés, tc..)
{$language.is_rtl} -> ( 1 -> Activado / 0 Desactivado (para cuando el idioma se escribe de derecha a izquierda)
{$language.format_lite} y {$language.format_full} -> Formato de fecha simplicado y formato de fecha completo
{$language.id} -> ID del idioma activado

 {$customer|var_dump}:

{$customer.lastname} -> Apellido del Cliente en Prestashop 1.7
{$customer.firstname} -> Nombre del Cliente Prestashop 1.7
{$customer.email} -> Email del Cliente Prestashop 1.7
{$customer.birthday} -> Fecha de cumpleaños del cliente Prestashop 1.7
{$customer.newsletter} -> Suscritos al boletín en Prestashop 1.7 (1 suscrito / 0 no suscrito)
{$customer.newsletter_date_add} -> Fecha de suscripción al boletín
{$customer.ip_registration_newsletter} -> IP Registro clientes newsletter
{$customer.optin} -> Suscrito a ofertas de nuestros socios en Prestashop 1.7
{$customer.date_add} -> Fecha creación del cliente en Prestashop 1.7
{$customer.date_upd}  -> Última fecha actualización del cliente en Prestashop 1.7
{$customer.id} -> ID del Cliente en Prestashop 1.7
{$customer.id_default_group} -> Grupo por defecto al que esta asociado el cliente en Prestashop 1.7
{$customer.is_logged} -> Comprobar si el cliente esta “logeado” en Prestashop 1.7
{$customer.gender.name[$customer.gender.id]} -> Genero del Cliente (Sr / Sra)
{$customer.addresses[ID Direccion].city} -> Ciudad del cliente de la dirección ‘X’ que tiene asociado.  (ID Dirección, porque un cliente teóricamente puede tener múltiples direcciones)
{$customer.addresses[ID Direccion].alias} -> Alias de la dirección
{$customer.addresses[ID Direccion].firstname} -> Apellido del titular de la dirección
{$customer.addresses[ID Direccion].lastname} -> Nombre del titular de dirección
{$customer.addresses[ID Direccion].company} -> Nombre empresa del titular de la dirección
{$customer.addresses[ID Direccion].address1} -> Dirección 1
{$customer.addresses[ID Direccion].address2} -> Dirección 2
{$customer.addresses[ID Direccion].postcode} -> Código postal de la dirección
{$customer.addresses[ID Direccion].id_state} -> ID de la provincia de la dirección
{$customer.addresses[ID Direccion].state} -> Provincia de la dirección
{$customer.addresses[ID Direccion].state_iso} -> Código ISO de la provincia de la dirección
{$customer.addresses[ID Direccion].id_country} -> ID País de la dirección
{$customer.addresses[ID Direccion].country} -> País de la dirección
{$customer.addresses[ID Direccion].country_iso} -> Código ISO del país de la dirección
{$customer.addresses[ID Direccion].phone} -> Teléfono de la dirección
{$customer.addresses[ID Direccion].phone_mobile} -> Teléfono móvil de la dirección
{$customer.addresses[ID Direccion].dni} -> DNI de la dirección
{$customer.addresses[ID Direccion].vat_number} -> Numero IVA Cliente
{$customer.addresses[ID Direccion].formatted} -> Dirección formateada del Cliente

 {$page|var_dump}:

Meta Titulo (Titulo)  página -> {$page.meta.title}
Meta Descripción página -> {$page.meta.description}
Nombre sección donde estamos situado -> {$page.page_name}

 {$urls|var_dump}:

{$urls.base_url} -> Dirección tienda
{$urls.current_url} -> Actual dirección (url) donde nos encontramos
{$urls.shop_domain_url} -> Dominio de la tienda
{$urls.img_ps_url} -> Url del directorio raíz de imágenes
{$urls.img_cat_url} -> Url del directorio de imágenes de las categorías
{$urls.img_lang_url} -> Url del directorio de imágenes de los idiomas
{$urls.img_prod_url} -> Url del directorio de imágenes de los productos
{$urls.img_manu_url} -> Url del directorio de imágenes de los fabricantes
{$urls.img_sup_url} ->Url del directorio de imágenes de los proveedores
{$urls.img_ship_url} -> Url del directorio de imágenes de los transportistas
{$urls.img_store_url}
{$urls.img_url} -> Url del directorio de imágenes de la plantilla
{$urls.css_url} -> Url del directorio de CSS de la plantilla
{$urls.js_url} -> Url del directorio de JS de la plantilla
{$urls.pic_url} -> Url del directorio de ficheros subidos
{$urls.pages.address} ->Url de la sección “Mis dirección”
{$urls.pages.addresses} -> Url de la sección “Mis direcciones”
{$urls.pages.authentication} -> Url de la sección de la página de autentificación
{$urls.pages.cart} -> Url de la sección del carrito (resumen pedido)
{$urls.pages.category} -> Url de la sección de las categorías
{$urls.pages.cms} -> Url de la sección de contenidos
{$urls.pages.contact} –> Url de la sección del formulario de contacto
{$urls.pages.discount} -> Url de la sección vales de descuento
{$urls.pages.guest_tracking} -> Url de seguimiento para clientes no registrados
{$urls.pages.history} -> Url de la sección del historial de pedidos
{$urls.pages.identity} ->  Url de la sección “Datos personales”
{$urls.pages.index} -> Url de la página
{$urls.pages.my_account} -> Url de la sección mi cuenta
{$urls.pages.order_confirmation} -> Url de la sección de la página de confirmación del pedido.
{$urls.pages.order_follow} –> Url de la sección “Seguimiento del pedido”
{$urls.pages.order}
{$urls.pages.order_return}
{$urls.pages.order_slip}
{$urls.pages.pagenotfound} -> Url de la sección “404 (Página no encontrada)”
{$urls.pages.password} -> Url de la sección “Recuperar Contraseña”
{$urls.pages.pdf_invoice} ->
{$urls.pages.pdf_order_return}
{$urls.pages.pdf_order_slip}
{$urls.pages.prices_drop} -> Url de la sección bajamos los precios/productos rebajados/descuentos
{$urls.pages.product} -> Url de la ficha del producto
{$urls.pages.search} -> Url de la sección del buscador
{$urls.pages.sitemap} -> Url de la sección del Mapa de sitio
{$urls.pages.stores} -> Url de la sección “Tiendas / Nuestras tiendas”
{$urls.pages.supplier} -> Url de la sección de los proveedores
{$urls.pages.register} -> Url de la página de registro
{$urls.pages.order_login} 
{$urls.theme_assets} -> Url del directorio “assets” de la plantilla /themes/plantilla/assets/
{$urls.actions.logout} -> Url para cerrar sección en la tienda



Share this post


Link to post
Share on other sites
  • 0

As a developer, since the 1.7 version was launched, I often found myself in the need of a list with Prestashop 1.7 Smarty Global Variables and I know many others were in this situation. Same as you maybe, reading this article, you may also looking for a similar list. So here it is, use it wisely ("with great power comes great responsibility").
 

The most used arrays:
 
{$urls|@var_dump} -> Contains Prestashop urls;
{$shop|@var_dump} -> Contains shop variables (shop name, email, phone, etc...);
{$page|@var_dump} -> Contains current page variables;
{$currency|@var_dump} -> Currency variables;
{$language|@var_dump} -> Language variables;
{$customer|@var_dump} -> Customer variables;
{$configuration|@var_dump} -> Configuration variables;

{$link|@var_dump} -> Link variables;

{$breadcrumb|@var_dump} -> Breadcrumb variables;

 

And here are some ready-tu-use variables:
 
{$currency.name} -> Name of the active currency. 
{$currency.iso_code} -> ISO language code enabled. 
{$currency.sign} -> Symbol of the active currency 
{$currency.iso_code_num} -> Active Currency ISO Code
 
{$shop.name} -> Store name in Prestashop 1.7 
{$shop.email} -> Store Email in Prestashop 1.7 
{$shop.logo} -> Image routing store logo in Prestashop 1.7 
{$shop.favicon} -> Route favicon image of the store in Prestashop 1.7 
{$shop.address.address1} -> Store address 1 in Prestashop 1.7 
{$shop.address.address2} -> Store address 2 in Prestashop 1.7 
{$shop.address.postcode} -> Store Zip Code in Prestashop 1.7 
{$shop.address.city} -> Store City in Prestashop 1.7 
{$shop.address.state} -> Province of the store in Prestashop 1.7 
{$shop..address.country} -> Shop Country in Prestashop 1.7 
{$shop.phone} -> Store phone in Prestashop 1.7 
{$shop.fax} -> Store Fax in Prestashop 1.7
 
{$language.name} -> Language name enabled 
{$language.iso_code} -> ISO language code enabled 
{$language.language_code} -> Language code enabled (for Spanish, fr for French, tc ..) 
{$language.is_rtl} -> (1 -> On / 0 Off (for when language is written from right to left) 
{$language.format_lite} and {$ language.format_full} -> Simulated date format and full date format 
{$language.id} -> Language ID enabled
 
{$customer.lastname} -> Customer Last Name in Prestashop 1.7
{$customer.firstname} -> Client Name Prestashop 1.7
{$customer.email} -> Prestashop Customer Email 1.7
{$customer.birthday} -> Prestashop client birthday 1.7
{$customer.newsletter} -> Subscribed to the newsletter in Prestashop 1.7 (1 subscribed / 0 unsubscribed)
{$customer.newsletter_date_add} -> Newsletter subscription date
{$customer.ip_registration_newsletter} -> IP Registration Customers newsletter
{$customer.optin} -> Subscribed to offers from our partners in Prestashop 1.7 
{$customer.date_add} -> Client creation date in Prestashop 1.7
{$customer.date_upd} -> Last updated client update in Prestashop 1.7
{$customer.id} -> Customer ID in Prestashop 1.7
{$customer.id_default_group} -> Default group to which the client is associated in Prestashop 1.7
{$customer.is_logged} -> Check if the client is "logged in" in Prestashop 1.7
{$customer.gender.name [$ customer.gender.id]} -> Client Gender (Mr / Ms)
{$customer.addresses [Address ID] .city} -> Client city of address 'X' that has partner. (Address ID, because a client can theoretically have multiple addresses)
{$customer.addresses [Address ID] .alias} -> Address alias
{$customer.addresses [Address ID] .firstname} -> Addressholder last name
{$customer.addresses [Address ID] .lastname} -> Name of address holder
{$customer.addresses [Address ID] .company} -> Company name of address holder
{$customer.addresses [Address ID] .address1} -> Address 1
{$customer.addresses [Address ID] .address2} -> Address 2
{$customer.addresses [Address ID] .postcode} -> Mailing address
{$customer.addresses [Address ID] .id_state} -> Address Province ID
{$customer.addresses [Address ID] .state} -> Province address
{$customer.addresses [Address ID] .state_iso} -> ISO address province code
{$customer.addresses [Address ID] .id_country} -> Country address ID
{$customer.addresses [Address ID] .country} -> Country of address
{$customer.addresses [Address ID] .country_iso} -> ISO country address code
{$customer.addresses [Address ID] .phone} -> Address phone
{$customer.addresses [Address ID] .phone_mobile} -> Mobile phone address
{$customer.addresses [iD Address] .dni} -> Address ID
{$customer.addresses [Address ID] .vat_number} -> Customer VAT number
{$customer.addresses [Address ID] .formatted} -> Client formatted address
 
{$urls.base_url} -> Store address 
{$urls.current_url} -> Current address (url) where we are 
{$urls.shop_domain_url} -> Store domain 
{$urls.img_ps_url} -> Image root directory url 
{$urls.img_cat_url} -> Url directory of images of the categories 
{$urls.img_lang_url} -> Url of the language images directory 
{$urls.img_prod_url} -> Url of the product images directory 
{$urls.img_manu_url} -> Url directory of manufacturers images 
{$urls.img_sup_url} -> Url of the providers directory 
{$urls.img_ship_url} -> Url directory of images of carriers 
{$urls.img_store_url} -> Store url
{$urls.img_url} -> Url of the image directory of the template 
{$urls.css_url} -> Template URL directory url 
{$urls.js_url} -> Template JS directory url 
{$urls.pic_url} -> Url file directory uploaded 
{$urls.pages.address} -> Url from the "My Address" section 
{$urls.pages.addresses} -> Url from the "My addresses" section 
{$urls.pages.authentication} -> Url section of the authentication page 
{$urls.pages.cart} -> Cart section url (order summary) 
{$urls.pages.category} -> Url section of categories 
{$urls.pages.cms} -> Url of the content section 
{$urls.pages.contact} - > Url section of the contact form 
{$urls.pages.discount} -> Url of the discount voucher section 
{$urls.pages.guest_tracking} -> Tracking url for unregistered clients 
{$urls.pages.history} -> Url from the order history section 
{$urls.pages.identity} -> Url of the section "Personal data" 
{$urls.pages.index} -> Page url 
{$urls.pages.my_account} -> Url section of my account 
{$urls.pages.order_confirmation} -> Url section of the order confirmation page. 
{$urls.pages.order_follow} - > Url in the "Order Tracking" 
{$urls.pages.order} -> Url of the order page
{$urls.pages.order_return} -> Url of the order return page
{$urls.pages.order_slip} -> Url of the order slip page
{$urls.pages.pagenotfound} -> Url of section "404 (Page not found)" 
{$urls.pages.password} -> Url of the section "Recover Password" 
{$urls.pages.pdf_invoice} -> Pdf invoice page url
{$urls.pages.pdf_order_return} -> Pdf order return page url
{$urls.pages.pdf_order_slip} -> Pdf order slip url page
{$urls.pages.prices_drop} -> Url section we lowered prices / products discount / discounts 
{$urls.pages.product} -> Product tab url 
{$urls.pages.search} -> Url of the searcher section 
{$urls.pages.sitemap} -> Site Map section url 
{$urls.pages.stores} -> Url of the section "Shops / Our stores" 
{$urls.pages.supplier} -> Url from the providers section 
{$urls.pages.register} -> Url log page 
{$urls.pages.order_login} -> Order login page url
{$urls.theme_assets} -> Url of the "assets" directory of the template / themes / template / assets / 
{$urls.actions.logout} -> Url to close section in the store

 

Share this post


Link to post
Share on other sites
  • 0

Thank you very much, for debug option.

  I see that there is not product variable product without tax, if I want to do this I must sum single product * quantity in "foreach".

 

How it is possible modify the variable cart with another parameter?

 

Thank you very much

 

Best regards

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×