Jump to content

How use "convertPrice" in template for PrestaShop 1.7?


JA MODULES

Recommended Posts

  • 5 months later...
  • 2 years later...

Hello! I updated the store from 1.6.1.24 to the latest version 1.7.6 and I get the following error:

Syntax error in template "file: / home / quetupec / public_html / clonpresta / modules / loyalty / views / templates / hook / shopping-cart .tpl "on line 32" {ls = 'that can be converted to a voucher of' mod = 'loyalty'} {convertPrice price = $ voucher} {if isset ($ guest_checkout) && $ guest_checkout} <sup> * </ sup> {/ if}. <br /> "unknown tag 'convertPrice'

I have correctly selected my currency and location of the store.

Link to comment
Share on other sites

Il y a 9 heures, Que Tupe a dit :

Hello! I updated the store from 1.6.1.24 to the latest version 1.7.6 and I get the following error:

Syntax error in template "file: / home / quetupec / public_html / clonpresta / modules / loyalty / views / templates / hook / shopping-cart .tpl "on line 32" {ls = 'that can be converted to a voucher of' mod = 'loyalty'} {convertPrice price = $ voucher} {if isset ($ guest_checkout) && $ guest_checkout} <sup> * </ sup> {/ if}. <br /> "unknown tag 'convertPrice'

I have correctly selected my currency and location of the store.

This due to you module. It seems it's not compatible 1.7.x

Il y a 6 heures, shoptechmedia a dit :

I am looking to see the correct answer to 

I am looking to see the correct answer to this, as I have the same issue with 1.7.x .. no problem of course with 1.6..

After take a look to new prestashop template 1.7 (templates/catalog/_partials/product-prices), it seems they do not use convertPrice anymore.

In website root /src/Adapter/Presenter/Product/ProductlazyArray you can find $this->priceFormatter->format(xx) Maybe it's the best way to do.

Link to comment
Share on other sites

  • 5 months later...
On 7/16/2019 at 6:37 PM, Arnaud Drieux said:

This due to you module. It seems it's not compatible 1.7.x

After take a look to new prestashop template 1.7 (templates/catalog/_partials/product-prices), it seems they do not use convertPrice anymore.

In website root /src/Adapter/Presenter/Product/ProductlazyArray you can find $this->priceFormatter->format(xx) Maybe it's the best way to do.

Thanks Arnaud Drieux,

its worked for me, i have been upgrading my site from 1.6 to latest versiob 17.6.x

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...
  • 2 months later...
On 1/15/2020 at 1:01 AM, mikhsanh said:

Thanks Arnaud Drieux,

its worked for me, i have been upgrading my site from 1.6 to latest versiob 17.6.x

 
 
 
 
 
 

Could you please say how you used this function?

Previously we used {convertPrice price=$product.price} but it's no longer working.

What's the code that we write into our templates now, to achieve the same thing??

 

There are several answers here:

{$product->convertPrice($product.price)} does not work

{Tools::displayPrice($product.price)} works for me right now, but also someone said it's deprecated. 

Edited by theillo (see edit history)
Link to comment
Share on other sites

il y a 33 minutes, theillo a dit :

Could you please say how you used this function?

Previously we used {convertPrice price=$product.price} but it's no longer working.

What's the code that we write into our templates now, to achieve the same thing??

 

There are several answers here:

{$product->convertPrice($product.price)} does not work

{Tools::displayPrice($product.price)} works for me right now, but also someone said it's deprecated. 

It seems you now need to do this in php file and not in tpl file

Like I wrote on 16July 2019:

Citation

 

[...]After take a look to new prestashop template 1.7 (templates/catalog/_partials/product-prices), it seems they do not use convertPrice anymore.

In website root /src/Adapter/Presenter/Product/ProductlazyArray you can find $this->priceFormatter->format(xx) Maybe it's the best way to do.

 

😉

Link to comment
Share on other sites

Le 11/05/2020 à 11:11 PM, theillo a dit :

So as a theme developer, which PHP file should I be modifying?

I'm converting my PS 1.6 theme over to PS 1.7 (ssems like the OP was doing something similar)

Since PS 1.7 I've never work again on prestashop template. Only module and specific dev.
You need to look wich template you need to modify and find controller associated to it.

Link to comment
Share on other sites

  • 2 years later...

Tools::convertPrice is deprecated since 1.7.4, Tools::displayPrice is deprecated Since 1.7.6.0.

Use one of these in a Smarty template:

  • {Context::getContext()->currentLocale->formatPrice($combination.price, $currency.iso_code)}
    • Suitable if you need price format only, without currency conversion.
    • defined as public function formatPrice($number, $currencyCode)
  • {Product::convertandformatPrice($combination.price)}
    • defined as public static function convertAndFormatPrice($price, $currency = false, Context $context = null)
  • Like 2
Link to comment
Share on other sites

  • 2 years later...

Hola 

Por favor si quereis ayudar a la gente que sabe poco. Por favor poner las direccion completas.  /themes/TU_TEMA/ adcasda/asdfa/asda/  sino lo que no sabemos mucho no hacemos mas que perder el tiempo sin encontrar los archivos. 

Animo que el teclado no se gasta por eso.

Adios.

 

Link to comment
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
×
×
  • Create New...